## Friday, November 04, 2011

### Function transformations

I wish I had a little cheat-sheet like this during my math classes:

Given vertical translation a (+ to shift up, - to shift down), vertical scaling b (larger to grow, smaller to shrink), horizontal translation c (+ to shift right, - to shift left), and horizontal scaling d (larger to grow, smaller to shrink), the function transformation would be:

(f((x-c)/d)+a)/b

You can pick and choose values.  If you don't have a or c, replace with 0.  If you don't have b or d, replace with 1.

Assume our function f was the sine function.  sin(x):

Say we wanted to shift the whole function to the right by +1, i.e. up the x-axis.  c=1 and our transformation would be sin(x - [+1]):

Note how the graph used to cross the x-axis at 0 (red), but now crosses it at 1 (green).

Say we now wanted to stretch it longer, i.e. horizontally scale it.  Maybe stretch it twice as long.   If we choose a horizontal scaling factor of  d=2, our new function would be sin((x-1)/2):

Now perhaps we want to shift it upwards, e.g. a=1.  Our new function is sin((x-1)/2)+1:

And finally, we want to stretch our function in the vertical axis, perhaps also by double, so b=2.  (sin((x-1)/2)+1)*2:

Before, it ranged from a minimum y of 0 to a maximum y of 2, now the maximum y is 4.