Transforming $f(x)=x^2$ into $g(x)=8x^2$ can both be interpreted as a vertical stretch by a factor of $8$, or it can also be interpreted as a horizontal compression, by a factor of $\sqrt{8}$:
$8f(x)=8\cdot x^2=8x^2 \;\;(\text{This is a vertical stretch by factor of 8})$
$f(\sqrt{8}x)=((\sqrt{8}x))^2=8x^2\;\; (\text{This is a horizontal compression by a factor of } \sqrt{8})$
Maybe you are confusing horizontal stretches and compressions. Recall that for $f(ax)$:
- If $a$ is between $0$ and $1$, then the graph is stretched horizontally. This means that $a$ is a fraction. If this happens, we say that the graph is stretched by a factor $a$.
- If $a$ is bigger than $1$, then the graph is compressed horizontally. If this happens, we say that the graph is compressed by a factor of $a$.
For example, say I have a function $g(x)$. Then:
$g(5x)$ is a horizontal compression by a factor of $5$. $(\text{This is because 5>1})$
$g\left(\frac{1}{2}x\right)$ is a horizontal stretch by a factor of $\frac{1}{2}.\;\;(\text{This is because}\frac{1}{2}<1)$