An horizontal compression (or stretch) acts on the horizontal axis, which is related with variable x. Then, we have
Now, a vertical compression (or stretch) acts on the vertical axis, which is related with variable y (or f(x)). Then, we have
If we have the following expression:
the parent function is
so, in order to get g(x) from f(x), we need a translation up 2 units and a vertical stretch by 1/3, that is,