Mechanics of Horizontal Stretching and Shrinking

I know $y=2f(x)$ doubles the $y$ value in vertical shifting, and I know that $y=(1/2)f(x)$ halves the $y$ value. But, why does $y=f(2x)$ halve the $x$ value, and why does $y=f((1/2)x)$ double the $x$ value in horizontal shifting? I looked at the graphs, and I see the difference, but I want to know the math behind why it halves instead of doubling the $x$ value for $y=f(2x)$. Maybe this is a stupid question, but could someone help me out?

Thank you.


If you let $$\ g(x) = 2f(x) $$ then in words you understand that

The value of $g$ at some $x$ is twice the value of $f$ there.

You stretch the height of the graph of $f$ to get the graph of $g$.

If you let $$\ h(x) = f(2x) $$ then in words

The value of $h$ at $x$ is the value $f$ has at $2x$, twice as far along on the $x$-axis.

So to get the graph of $h$ on, say, the interval $[0,1]$ you find the values of $f$ on $[0,2]$ and slide them halfway to the vertical axis. That shrinks the graph of $f$ horizontally.

The same kind of analysis explains why $g(x) = f(x)+2$ shifts the graph up (positive direction) while $h(x) = f(x+2)$ shifts the graph left (negative direction).


Not a stupid question at all. A common and very reasonable question, in fact. Consider:

$$y=2f(x).$$

As you wrote, the graph will be stretched vertically by a factor of $2$. Note how it is written. The $y$ value equaled something, and we doubled that thing - we literally multiplied it by $2$.

When we write:

$$y=f(2x),$$

we do not operate in quite the same way. Instead of having $x$ equal something and doubling that thing, we have instead halved the value needed to obtain a specific $y$. It may be worth reading through that sentence a few times.

You cannot always do this easily, but if you take a simple enough function, such as perhaps $f(x)=2x+5$ and/or $f(x)=\dfrac{1}{x-1}$, and solve it for $x$, so that $x$ is a function of $y$, then the roles will switch. $f(2y)$ will be a vertical shrink by $2$, instead of a stretch. Does this help?