Say you have a function $f(x)$ and a line $g(x)=ax+b$. How do you reflect $f$ about $g$?
I am apparently supposed to write more text, but the line above is all I am after, hence I wrote this sentence as well.
Say you have a function $f(x)$ and a line $g(x)=ax+b$. How do you reflect $f$ about $g$?
I am apparently supposed to write more text, but the line above is all I am after, hence I wrote this sentence as well.
We can implement this as a translation of the line to the origin, a reflection about the line through the origin, and then a translation back in the same direction.
In particular: suppose we want to reflect a point $(x_0,y_0)$ across this line.
First translate it to the point $(x_1,y_1) = (x_0,y_0 - b)$.
Then, reflect $(x_1,y_1)$ across the line $y = ax$ to get $$ (x_2,y_2) = \frac1{a^2 + 1} ([1 - a^2]x_1 + 2a\,y_1,2a\,x_1 + [a^2 - 1]y_1) $$
Finally, translate back to get $(x_3,y_3) = (x_2,y_3 + b)$
So, the curve parametrized by $$ x = t\\ y = f(t) $$ Becomes the curve parametrized by $$ x = \frac{1 - a^2}{a^2 + 1}\,t + \frac{2a}{a^2 + 1}(f(t) - b) \\ y = \frac{2a}{a^2 + 1}\,t + \frac{a^2 - 1}{a^2 + 1}(f(t) - b)+b $$ Note: there is no guarantee that we can write $y$ as a function of $x$.
Interesting cases: if we take $g(x) = 0x + b$, then we get $$ y = - (f(t) - b) + b = 2b - f(t)\\ x = t $$ which is simply the curve $y = 2b - f(x)$.
If we take $g(x) = x$, then we get $$ y = t\\ x = f(t) $$ This is the curve $x = f(y)$. When $f$ is invertible, we can rewrite this as $y = f^{-1}(x)$.
Represent the graph of f parametrically by $x=t, y=f(t)$.
If we reflect the point $(t, f(t))$ in the line $y=ax+b$ to get the point $(x,y)$, then $\color{red}{y-f(t)=-\frac{1}{a}(x-t)}$
since the line and the line segment between $(t, f(t))$ and $(x,y)$ are perpendicular to each other.
We also have that $\frac{y+f(t)}{2}=a\left(\frac{x+t}{2}\right)+b$ and therefore $\color{red}{y+f(t)=a(x+t)+2b}$
since the midpoint of the line segment lies on the line.
Subtracting these equations gives $2f(t)=ax+at+\frac{1}{a}x-\frac{1}{a}t+2b=\left(\frac{a^2+1}{a}\right)x+\left(\frac{a^2-1}{a}\right)t+2b$,
and solving for x gives $\displaystyle \color{blue}{x=\frac{1-a^2}{1+a^2}t+\frac{2a}{a^2+1}\left(f(t)-b\right)}$.
Solving for x in the first equation gives $-ay+af(t)=x-t$ and so $\color{red}{x=-ay+af(t)+t}$.
Substituting into the second equation gives
$y+f(t)=a\big(-ay+af(t)+2t\big)+2b=-a^2y+a^2f(t)+2at+2b,$ and solving for y gives
$(a^2+1)y=(a^2-1)f(t)+2(at+b)$ so $\displaystyle\color{blue}{y=\frac{a^2-1}{a^2+1}f(t)+\frac{2}{a^2+1}(at+b)}$.