Stefy just looked for a formula of the form y = mx + c so that when x = -2, then y = 3, and similarly when x = 8, y = 5.
My answer used a similar idea but I think his is the right way.
If you think about the straight line graph this produces, every point between -2 and 8, will map onto every point between 3 and 5
And the mapping is reversible.
To prove it, you'd have to show the mapping is 1:1 in both direcctions, and that a point inside the first interval maps to a point inside the resulting interval.
Bob