# Order of transformations in a composite function?

I am considering the function $f(x)=\sin(2x+30)$ and have been thinking of how I would sketch it. (NOTE: I have not looked at a graph of the function yet because I would rather know where my mistake is considering the algebraically...)

I first thought of f(x) as being a composite function $f(x)=j(g(h(x)))$ where $j(x)= \sin(x)$ and either:

1. $g(x)=x+30$ and $h(x)=2x$ or...
2. $g(x)=2x$ and $h(x)=x+15$

both of which I think would work.

Now when I am sketching the curve using the first method, and I consider the point that is $(0,0)$ on the graph of $y=\sin(x)$, then I would first squash the curve by factor 2, and then shift it to the left by 30, landing at $(-30,0)$- Something tells me that I am not doing this right because if I am squashing the x axis then a shift of 30 won't really be of 30? But I'm not quite sure...

If I use the second method, I shift by 15 to the left and then squash the curve by factor 2, which leaves me at $(-7.5,0)$.

I have a feeling that neither of these are correct and I am looking for $(-15,0)$... Actually, thinking about it now, of course I would be trying to get to $(-15,0)$ because when $x=-15$, then $2x+30=0$, and $sin(0)=0$. However I am not sure how to arrive at $(-15,0)$ working through composite functions. In the above case, I have always applied the inner function first to the graph, and then the outer function, as you would when evaluating each new point in a composite function...

I am not sure where I am going wrong! Any help would be much appreciated!

The easiest way it to break it down into steps. Put:

$$g(x)=\sin (2x)$$

which you can sketch knowing the graph of $\sin$ (stretch vertically by a factor of $2$).

Now note that $f(x)=g(x+15)$. So the graph of $f$ is the same as the graph of $g$ shifted to the left by $15$ units.

Therefore, the graph of $f$ is obtained from that of $\sin$ by first stretching by a facotr of $2$, and then translating by $15$.

Thank you @Reveillark for your answer. It helped me to realise a few things which I have decided to put into a separate answer. I would be grateful to any users who add to/change my post to improve it.

And note that this refers to having a certain function already graphed, say $y=f(x)$, and trying to figure out what the transformed graph $y=a+bf(cx+d)$ would look like by considering only translations/shifts, stretches (and reflections) of the original graph of $y=f(x)$. It does not pertain to graphing $y=a+bf(cx+d)$ by considering each x value in turn, then moving to the x value of $cx+d$, then applying the known function $f(x)$ to this new x value, then applying the y transformations. Although thinking of this process in reverse is useful for transforming graphs.

Points of consideration:

1. Considering transformations in the x axis of a graph must be approached differently to transformations in the y axis.

When you transform in the y axis, (say, $y=sin(x)$ to $y=3+2sin(x)$), then each output you get from your original function just undergoes these transformations from inside to outside. For instance, if you have a single coordinate $(x_1,y_1)$, then the y value (which is equal to $sin(x_1)$) is multiplied by 2 (so stretch parallel to y axis by factor 2) and then 3 is added to the result (shift upwards by 3).You could also consider $y=2(\frac{3}{2}+sin(x))$ and again, working from inside to out, shift the graph up by 1.5 units and then stretch by a factor of 2. Either of these would result in the same, transformed graph.

2. When considering, graphically, the transformations in x, such as $y=sin(x)$ to $y=sin(2x+30)$, then you are considering a certain point on the graph $(x_1,y_1)$, and you are trying to ask yourself "If I had the output $y_1$ on my new graph, what value of x would be producing it?" i.e. to what position along the x axis should i shift this point where the y value is $y_1$? To do this, you have to work backwards from the outer to the innermost function. In the example, you could make the functions $y=sin((2(x))+30)$ So you have $y=j(g(h(x)))$ were $j(x)=sin(x), g(x)=x+30, h(x)=2x$. Working from the outside in, you start with $y=sin(x)$ But now you replace x with $x+30$, meaning a shift of 30 degrees to the left. So if you had the graph of $y=sin(x+30)$, now you have each new value of x that gives the known value of y on this function. But then you can also half each resulting x coordinate (a squash by factor of 2 parallel to the x axis) because you have $y=sin(2x+30)$. This gives you the transformed graph. You could also split the function as $y=sin(2[(x)+15])$ in which case $j(x)=sin(x), g(x)=2x, h(x)=x+15$. Then working from the outwards in you first squash sin(x) by factor 2, then shift by 15 degrees to the left. This gives the same graph.

I think the key is how you think about the process you are doing. For linear transformation in the y axis it is much simpler because you just take each output of the known original function, and apply more operations on it. When it comes to transformations in the x axis, to transform one graph into another, you are considering- for this given output value of y, what x value would give rise to this value of y in my new, transformed function. This will tell me to which new x coordinate I have to shift this point.

So, I think, for transformations in y apply the composite functions from the inside out, and for transformations in x deal with each composite function from the outside to in.