The Formula for Rotating a Function's Graph (A Lesson in "Taking Things for Granted")
A reading tip: Dear reader, you're free to skip this post, but if you decide to read it, please read it all the way to the end. BoJone bears no responsibility whatsoever for the consequences of "giving up halfway"^_^.
Let's consider the following rotation problem: given a function graph y = f(x), rotate it counterclockwise by angle θ about the point (p, q), and find the analytic expression of the resulting graph. more
First, since this is purely a rotation, the overall shape of the graph doesn't change, so it must still be the original function f — or so we might think. Let's pick an arbitrary point (x, y) on the original graph, which corresponds to the point (x', y') on the rotated graph. Then the analytic expression of the new graph should be y' = f(x'). Moreover, since the graph is rotated about (p, q), the two points (x, y) and (x', y') must be equidistant from (p, q); call this distance r, i.e. $\sqrt{(x-p)^2+(y-q)^2}=r$. Let α be the angle between the segment (x, y)–(p, q) (meaning the segment connecting the two points, as below) and the line through (p, q) parallel to the x-axis. Then we have:
$\sin\alpha=\frac{y-q}{r}$, $\cos\alpha=\frac{x-p}{r}$
Hence:
$$\begin{aligned}\sin(\alpha +\theta)=\sin\alpha \cos\theta+\sin\theta \cos\alpha= \frac{y-q}{r} \cos\theta+\frac{x-p}{r}\sin\theta \\ \cos(\alpha +\theta)=\cos\alpha \cos\theta-\sin\theta \sin\alpha= \frac{x-p}{r} \cos\theta-\frac{y-q}{r}\sin\theta\end{aligned}$$
And so, quite obviously:
$$\begin{aligned}y' =(\frac{y-q}{r} \cos\theta+\frac{x-p}{r}\sin\theta)r+q=(y-q)\cos\theta+(x-p)\sin\theta+q \\ x' =(\frac{x-p}{r} \cos\theta-\frac{y-q}{r}\sin\theta)r+p=(x-p)\cos\theta-(y-q)\sin\theta+p\end{aligned}$$
At this point, the problem seems solved, and the analytic expression of the new function is:
$$(y-q)\cos\theta+(x-p)\sin\theta+q=f[(x-p)\cos\theta-(y-q)\sin\theta+p]$$
In particular, for a rotation about the origin, the equation is:
$$y \cos\theta+x \sin\theta=f(x \cos\theta-y \sin\theta)$$
For example: take y = 6 - x, rotate it counterclockwise by 45° about (0, 0), and the result is
$$\begin{aligned}\frac{\sqrt{2}}{2}(x+y)=6-[\frac{\sqrt{2}}{2}(x-y)] \\ x=3\sqrt{2}\end{aligned}$$
Wait a minute — something's wrong! We clearly had $y=3\sqrt{2}$, so how did it turn into this? Ha, you've fallen into the same "trap" I did! Looking more carefully, something does seem off; but check it again, and it seems fine after all. What's going on? Actually, the problem arose right at the very beginning!
At the very start, we simply assumed that the new graph's function is f (note the underline) — this assumption is completely unfounded, and in fact wrong. We already know that the function of the original graph is y = f(x), and from that we can determine the relationship between (x, y) and (x', y'); what we're actually looking for is the relationship between x' and y'. The correct approach is: express x and y separately in terms of x' and y', then substitute into y = f(x), and the result will be the relationship between x' and y'! The original line of reasoning wasn't wrong per se — we just need to modify the earlier derivation to arrive at the correct answer:
Let β = α + θ. Then
$$\begin{aligned}\sin(\beta-\theta)=\sin\beta \cos\theta-\sin\theta \cos\beta= \frac{y'-q}{r} \cos\theta-\frac{x'-p}{r}\sin\theta \\ \cos(\beta -\theta)=\cos\beta \cos\theta+\sin\theta \sin\beta= \frac{x'-p}{r} \cos\theta+\frac{y'-q}{r}\sin\theta\end{aligned}$$
And so, quite obviously:
$$\begin{aligned}y =(\frac{y'-q}{r} \cos\theta-\frac{x'-p}{r}\sin\theta)r+q=(y'-q)\cos\theta-(x'-p)\sin\theta+q \\ x =(\frac{x'-p}{r} \cos\theta+\frac{y'-q}{r}\sin\theta)r+p=(x'-p)\cos\theta+(y'-q)\sin\theta+p\end{aligned}$$
Substituting into y = f(x), we get
At last, we've obtained the correct analytic expression for the new function (counterclockwise):
$$(y-q)\cos\theta-(x-p)\sin\theta+q=f[(x-p)\cos\theta+(y-q)\sin\theta+p]$$
And for a clockwise rotation:
$$(y-q)\cos\theta+(x-p)\sin\theta+q=f[(x-p)\cos\theta-(y-q)\sin\theta+p]$$
In particular, for a rotation about the origin, the equation is:
$y cos\theta-x sin\theta=f(x cos\theta+y sin\theta)$ (counterclockwise)
$y cos\theta+x sin\theta=f(x cos\theta-y sin\theta)$ (clockwise)
No mistakes this time, right? Take y = 6 - x, rotate it counterclockwise by 45° about (0, 0), and the result is
$$\begin{aligned}\frac{\sqrt{2}}{2}(y-x)=6-[\frac{\sqrt{2}}{2}(x+y)] \\ y=3\sqrt{2}\end{aligned}$$
After all that trouble, we finally have the right answer...
Reflections:
Now you understand why I insisted you read this post all the way through, right? It's not that this post is especially important — it's that if you only read halfway, copied down the formula or method, and later found it kept giving you wrong answers when you used it, that would be a real shame^_^.
Why did I deliberately lead readers into a "trap" at the start? Because I believe many people have made this exact mistake. This post records BoJone's entire thought process on this problem — from the initial reasoning, to the error, to correcting the error. The root of the mistake lies in thinking "it should obviously be this way" or "it's probably like that." If you can't break free from that mindset, it's hard to make real progress in mathematics and physics. This post serves as a lesson for myself, and I hope it also helps readers avoid "repeating the mistakes of those who came before." Remember: there's no room for taking things for granted in mathematics and science!
Translated automatically with claude-sonnet-5; all equations are reproduced verbatim from the source. Copyright remains with the original author.
