Question regarding transformation of function dealing with $\sin(x)$ I know that $\sin\left(x+\dfrac{\pi}{4}\right)$ is $\sin(x)$ shifted to the left by $\pi/4$.
But I need to plot $\sin\left(3x+\dfrac{\pi}{4}\right)$ and it seems (graph) 

 that it is not achieved by shifting $\sin(3x)$ to the left by $\pi/4$ but more like by $\pi/12$. What am I doing wrong?
Must I first write $\sin\left(3\left(x+\dfrac{\pi}{12}\right)\right)$? Why?
 A: Shifting by $\pi/4$ and then squeezing the graph horizontally by a factor of $3$ (keeping the origin fixed)
is the same thing as first squeezing by a factor of $3$ and then shifting by $\pi/12$,
since in the first case the shift $\pi/4$ gets squeezed by a factor of $3$ too.
These two equivalent ways of thinking correspond to the two ways of writing the function:
plugging $t=3x$ into the shifted function $\sin(t+\pi/4)$,
or plugging $t=x+\pi/12$ into the squeezed function $\sin(3t)$.
A: Horizontal translations of any function have to be applied directly to the variable, before any operation is applied to it. Here's the proper way to translate a function horizontally:
Let $y=f(x)$ be the graph of any function in an xy-plane. If, for example, we assign $g(x)=f(x+2)$, then you know that the graph $y=g(x)$ will be the graph of f translated left 2 units.
Now in your case, $f(x)=\sin{3x}$. To translate the function left by $\pi/4$ units, we would need to assign 
$$g(x)=f(x+\frac{\pi}{4})=\sin{\left(3(x+\frac{\pi}{4})\right)}$$
A: One way of looking at this is it is not $t$ that gets shifted by $\frac{\pi}{4}$
units; it is $3t$ that gets shifted by $\frac{\pi}{4}$ or $3(\frac{\pi}{12})$ units.
The most straight forward way of understanding the concepts of stretches and shifts of a function that I have found is to analyze the behavior of its inverse.
Suppose that
$$s=f(t)=\sin\left(3t + \frac{\pi}{4}\right)$$
Furthermore, suppose that we restrict $t$ to an interval where $f$ is one-to-one (which is the same as restricting $3t+\frac{\pi}{4}$ to an interval where $\sin$ is one-to-one). Let the inverse of the $\sin$ function (denoted as $\sin^{-1}$) be defined over that restriction. Then it follows that
$$s = \sin\left(3f^{-1}(s) + \frac{\pi}{4}\right)$$
$$\sin^{-1}(s) = 3f^{-1}(s)+\frac{\pi}{4}$$
$$\sin^{-1}(s)-\frac{\pi}{4} = 3f^{-1}(s)$$
$$\frac{\sin^{-1}(s)-\frac{\pi}{4}}{3} = f^{-1}(s)$$
What this shows us is that when the argument is expressed in the form $3t+\frac{\pi}{4}$ both the horizontal values of the $\sin$ function, and the apparent shift gets compressed by a factor of $3$.
Simplifying we have
$$\frac{1}{3}\sin^{-1}(s) - \frac{\pi}{12} = f^{-1}(s)$$
This shows us a compression by a factor of $3$ followed by a decrease of $\frac{\pi}{12}$. This decrease shifts the $\sin^{-1}$ graph downwards and the $\sin$ graph to the left.
Finally, lets work backwards from our last equation
$$\frac{1}{3}\sin^{-1}(s) - \frac{\pi}{12} = f^{-1}(s)$$
$$\frac{1}{3}\sin^{-1}(s)  = f^{-1}(s) + \frac{\pi}{12}$$
$$\sin^{-1}(s)  = 3\left(f^{-1}(s) + \frac{\pi}{12}\right)$$
$$s  = \sin\left(3\left(f^{-1}(s) + \frac{\pi}{12}\right)\right)$$
$$f(t)  = \sin\left(3\left(t + \frac{\pi}{12}\right)\right)$$
Which gives us the $\sin$ function in the more familiar (and useful) form.
