Find the transformation that will reflect image I to image J

Let M be the maximum value of the pixels in image I and m the minimum value in image I (M and m are different). Find the transformation that will reflect image I to image J, so that the maximum value of image J is L while the minimum is 0 (zero)?

Okey here is my solution:
I will try to expand the function from (m,M) to (0,L) and we do it with formula:

For expansion from (m , n) to (M’, N’) we have the formula: $$ T(g) = ((N’- M’)/(n – m))(g – m) $$

Now for our example (m,M) to (0,L) we have:

$$ T(g) = ((L)/(M – m))(g – m) $$

Is this problem solved corretly?