How to shift and scale functions
We have a function 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: .
The graph of this function looks like this:
We can add some constants to the functions that will allow us to shift and scale it: . In our case we start by letting
and
be 1, and
and
be 0, which gives us the same
.
Shifting the function
First, let us shift the function along the y-axis. This corresponds to modifying the constant. By adding
to the function we move it up and down. Let us use
and
as an example. We get the functions
and
. 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):
Next, let us shift the function along the x-axis. This corresponds to modifying the 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
and
, so we get the functions
and
. It may seem counterintuitive first, that a positive number shifts to the left, but think of it this way: when you are at
, then by adding a positive value, say 2, we evaluate the function where it would be at
. So the function value from
was moved to the left to
. The following graph shows how the function is shifted:
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 is now at
). 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 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
,
and a negative value
. This gives us the functions:
,
and
. Let’s have a look at the graph of those functions:
Next, let us scale along the x-axis. This corresponds to the 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
and
we get
and
The graph look like this:
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 . We show the normal sine function in red for reference and our new function
is shown in blue.
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).