How to shift and scale functions

We have a function equation and with some simple operations we can shift the function along the x- and y-axes and also scale it (shrink and enlarge it).

Let us use a polynomial of second degree for this example: equation.

The graph of this function looks like this:

shiftscale1

We can add some constants to the functions that will allow us to shift and scale it: equation. In our case we start by letting equation and equation be 1, and equation and equation be 0, which gives us the same equation.

Shifting the function

First, let us shift the function along the y-axis. This corresponds to modifying the equation constant. By adding equation to the function we move it up and down. Let us use equation and equation as an example. We get the functions equation and equation. The following graph shows how the function is shifted down for a negative value, and up for a positive value (the red function is the original function for reference):

shiftscale2

Next, let us shift the function along the x-axis. This corresponds to modifying the equation constant. In this case, a positive value will shift the function to the left, and a negative value will shift it to the right. Again, let us use equation and equation, so we get the functions equation and equation. It may seem counterintuitive first, that a positive number shifts to the left, but think of it this way: when you are at equation, then by adding a positive value, say 2, we evaluate the function where it would be at equation. So the function value from equation was moved to the left to equation. The following graph shows how the function is shifted:

shiftscale3

Scaling the function

Scaling means shrinking or magnifying the function. If we scale it along the y-axis by a factor of 10, then where the function value was 10 before, it would now be 100. Scaling along the x-axis by a factor of 10 means that the function value of equation is now at equation). So everything that is left of the origin is shifted further to the left, and everything on the right is shifted further to the right.

First, let us scale along the y-axis. This corresponds to the equation constant. We simply multiply the function value by some number. A number greater than one will magnify the function and a number between 0 and 1 will shrink it in y-direction. A negative value will also mirror the function at the x-axis. Let us use a scaling factor of equation, equation and a negative value equation. This gives us the functions: equation, equation and equation. Let’s have a look at the graph of those functions:

shiftscale4

Next, let us scale along the x-axis. This corresponds to the equation constant. A value greater than one will shrink the function and a value between 0 and 1 will magnify it in x-direction. Again, a negative value will also mirror the function at the y-axis but because our example function is symmetric, it would look the same if it was mirrored. With the same values of equation and equation we get equation and equation The graph look like this:

shiftscale5

Combination of shifting and scaling

Of course, can can use a combination of all the shifting and scaling. Let use use a sine function for this example. We use all of our constants and set them to two, so we get the function equation. We show the normal sine function in red for reference and our new function equation is shown in blue.

shiftscale6

We can see the function is shifted up by 2 (along y), its phase is shifted by 2 (along x), its amplitude is scaled up by 2 (along y) and its frequency is scaled up by 2 (along x).