# Order of transformation of functions?

1. Aug 14, 2015

### Mr Davis 97

I am confused about the order in which we apply transformations to a input of a parent function to get the corresponding input of the new function. Say for example, we have the function $y = \sin(-2x + 1)=\sin(-2(x-\frac{1}{2}))$. Intuitively, it would seem as though we would transform a point from the parent function $y=\sin(x)$ by doing the following:
(4, - 0.7568)
(4.5, - 0.7568)
(2.25, - 0.7568)
(-2.25, - 0.7568)

However, when -2.25 radians is inputted into the new function, we get - 0.7055!

What am I doing wrong? I'm transforming the point as if it were an input to the function, but this is not producing the correct value. This begs the question: what is the order in which we apply transformations in order to get the correct value in the new function?

2. Aug 14, 2015

### Staff: Mentor

It's hard to tell what you're doing with the points above.
When you're analyzing the various transformations made to an untransformed function, look at things in this order:
1. Compressions or expansions
2. Reflections across an axis (or across the origin if there are two such reflections)
3. Translations

I believe that the compressions/expansions and reflections can be performed in either order, but the translations have to be last.

For your function, the base function is y = sin(x).
1. y = sin(2x) compresses the base function toward the x-axis.
2. y = sin(-2x) reflects the graph just above across the x-axis.
3. y = sin(-2(x - 1/2)) translates the graph in #2 1/2 unit to the right.

One of the points on the base graph is $(\pi/2, 1)$.
In #1, this point goes to $(\pi/4, 1)$.
In #2, the point above goes to $(-\pi/4, 1)$.
Finally, the point above goes to $(-\pi/4 + 1/2, 1)$.

It's easy to verify that if $-\pi/4 + 1/2$ is the input to y = sin(-2(x - 1/2)), the output is 1.

3. Aug 14, 2015

### RUber

If I understand you correctly, you are starting with sin(4) and trying to find the x such that -2x+1 = 4?
That doesn't seem like a challenging problem.
Transformations start from the outside in.
If you have $x' = g(h(x))$, then $g^{-1}(x') = h(x)$ and $h^{-1} (g^{-1}(x')) = x$.
So, in your example $\sin(x') = \sin( -2( x-1/2)) = \sin(g(h(x)))$
with:
$g(x) = -2x$
$h(x) = x-1/2$
having inverses:
$g^{-1}(x) = -x/2$
$h^{-1}(x) = x+1/2$
So looking for an x, given that x' = 4, $x=h^{-1} (g^{-1}(x')) = -4/2 + 1/2 = 1.5$.

4. Aug 15, 2015

### Mr Davis 97

Okay, so now I understand that the order in which you perform the transformations to a test point. However, why must this be the order? For example, given the function $y = \sin(-2x + 1)=\sin(-2(x-\frac{1}{2}))$ I would be inclined to take the point, $(\pi/2, 1)$, from the parent function, and start from the inside out such that I do
$$(\pi/2 + 1/2, 1)$$
$$(\pi/4 + 1/4, 1)$$
$$(-\pi/4 - 1/4, 1)$$

Of course this leads to the incorrect answer, but why does it? Essentially, I want to know why so that I don't make the mistake of doing it.

5. Aug 15, 2015

### Staff: Mentor

The short answer is, because if you do the translations before the compressions/expansions, you get the wrong answer.

Let's consider a slightly simpler example, y = f(x) = sin(2(x - 1/2))
The point (0, 0) is on the graph of y = sin(x).
If we look at the translation first (which is not the correct thing to do), we're looking at y = sin(x - 1/2), a translation to the right by 1/2 unit of the graph of y = sin(x). So it will contain the point (1/2, 0).

Next, we look at the compression. The factor of 2 should compress the graph of y = sin(x - 1/2) by a factor of 2 toward the y-axis. That would give us the point (1/4, 0).

A quick check shows that this is wrong. According to our calculations along the way, it should be that f(1/4) = 0.

f(1/4) = sin(2(1/4 - 1/2)) = sin(2(-1/4)) = sin(-1/2) ≠ 0.

This shows that we did something wrong.

OTOH, if we look at the compression first, we're looking at y = sin(2x), which should still have (0, 0) on its graph.
Now look at the translation, or y = sin(2(x - 1/2)). This should go through (1/2, 0).

A quick check shows that f(1/2) = sin(2(1/2 - 1/2)) = sin(0) = 0

As a sanity check, let's check another point on the graph of y = sin(x); namely, $(\pi/2, 1)$.
1. Compression: $(\pi/4, 1)$ should be on the graph of y = sin(2x).
2. Translation: $(\pi/4 + 1/2, 1)$ should be on the graph of y = sin(2(x - 1/2)).
The check: $f(\pi/4 + 1/2, 1) = sin(2(\pi/4 + 1/2 - 1/2)) = sin(2(\pi/4)) = sin(\pi/2) = 1$
Success!

I'll leave it for you to verify that starting with y = sin(x) and performing the transformations in the opposite order gives an incorrect result. As to why this is so, I've always been content to know what is the right way to look at these transformations, and haven't given much thought as to why one way works and another way doesn't. Possibly there is someone else here who has given it more thought.

6. Aug 16, 2015

### RUber

The explanation of why is given in my post above. Functions often do not commute. g(h(x)) is not equivalent to h(g(x)). And thus taking inverse a of these functions also is not give a commutative option.
If x' = g(h(x)) and you take the inverse of h first, you get
$h^{-1}(x') = h^{-1}(g(h(x)))$
This is not helping you find x.
For simple problems, it is easy enough to work out the answer algebraically.
Given some x', f(x') = f( -2x+1), then x'= -2x+1. Solve for x.