In High School Algebra , after studying how to plot a graph of $f(x)$ (rather called $y$) against $x$ in Cartesian coordinates, we studied several tests to determine the symmetry of the plotted graphs about the $x$ and $y$ axes, and around the origin point.

The tests seemed pretty simple and intuitive, you can Google them if you need to.

However, when I thought of investigating the symmetry of a certain function (say $f(x)$) about a given equation of a line or a curve (say $g(x)$), the solution did not seem to be that intuitive.

The case seemed trivial and easy when $g$ was simply $x=0$ or $y=0$, but what about other cases when $g(x)$ is in fact a function of $x$?

That is, How to investigate the symmetry of $f(x)$ around $g(x)$?

Another question that crossed my mind when thinking of the first one was the case when $f(x)$ is not simply a single function, as in discussing whether two functions (say $v(x)$ and $s(x)$) formed a mirror image of each other around a third function (say $g(x)$) or not. The case again seems simple enough when $v(x) = inverse(s(x))$ , and $g(x)=x$. Although I know no test for that, but it is always the case that a function and its inverse are symmetric around $g(x)=x$. And, again, I can't think of a possible way to check for the symmetry of two separate curves about a third curve, or even generate a mirror image of a given curve about another given curve (you may consider that last sentence a third part of the question).

  • $\begingroup$ Can you define what the mirror image across a curve is? It's obvious for lines, but what about other types of curves? $\endgroup$
    – f''
    Jun 24, 2016 at 4:51
  • $\begingroup$ @f If , for the case of f(x) to have to mirror-image sides around g(x), I guess the definition would go something like " Each point (x_0,y_0) lying on the curve g(x) is the midpoint of the line segment joining two points on the function f(x), where this line segment is perpendicular to the tangent to the curve g(x) at (x_0,y_0)".. For the case of two functions, I really have no idea about that. $\endgroup$ Jun 24, 2016 at 6:04

3 Answers 3


Instead of calling it the axis of symmetry, I will call it the function of symmetry. One of the characteristics of symmetry is that the function of symmetry must be an equal distance from both the original and mirror image. I suggest that we use lines perpendicular to the function of symmetry to define which points in the original and mirror image correspond to each other.
To find the slope of a function we calculate its derivative. $g'(x)$
To convert slope to perpendicular slope: $\frac{-1}{Slope}=\frac{-1}{g'(x)}$
Mirroring $f(x)$ over $g(x)$:
Consider mirroring the single point $(x, y)$ over $g(x)$.
Let $(a, g(a))$ equal the point on $g(x)$ at which the perpendicular line will cross.
The slope between those two points must equal the perpendicular slope. $$\frac{g(a)-y}{a-x}=\frac{-1}{g'(a)}$$ $$g'(a)(g(a)-y)=-1(a-x)$$ $$g'(a)g(a)-g'(a)y=x-a$$ If we were going to mirror the function $f(x)$, the equation would look like this: $$g'(a)g(a)-g'(a)f(x)=x-a$$ Let's use $g(x)=x^2$ and $f(x)=x$ as an example.
The slope at any point on $g(x)$ is $2x$. $g'(x)=2x$ $$2a*a^2-2a*x=x-a$$ $$2a^3-2ax=x-a$$ We must solve for $a$ to determine the perpendicular point on $g(x)$. Unfortunately, this cubic function is difficult to solve directly. There are ways to approximate. $$2a^3+a-2ax=x$$ $$2a^3+a(1-2x)=x$$ $$a^3+a\frac{(1-2x)}{2}=\frac{x}{2}$$ $$a^2+\frac{(1-2x)}{2}=\frac{x}{2a}$$ $$a^2=\frac{x}{2a}-\frac{(1-2x)}{2}$$ $$a^2=\frac{x}{2a}+\frac{(2x-1)}{2}$$ $$a^2=\frac{x}{2a}+x-\frac{1}{2}$$ $$a=\sqrt{\frac{x}{2a}+x-\frac{1}{2}}$$ To use this formula to approximate $a$, you can set $a$ equal to any number to start with (preferably a good guess). Plug the formula into itself many times. The formula will output a number closer to the true $a$ each time. Then calculate $g(a)$ to yield the point on $g(x)$ at which the perpendicular line will go through. $(a, g(a))$
To get the corresponding point on the mirror function we have to add the difference between the x and y components of the original point and the point on $g(x)$ to the point on $g(x)$. $$x_{new} = a+(a-x)$$ $$x_{new} = 2a-x$$ $$y_{new} = g(a)+(g(a)-f(x))$$ $$y_{new} = 2g(a)-f(x)$$ You can use this technique on several points on $f(x)$ to get the general shape of its mirror, but to get the equation for the mirror of $f(x)$ you would have to solve the cubic equation for $a$.
Detecting Symmetry:
Let $f(x)$ equal the function of symmetry.
Let $a(x)$ equal the original function.
Let $b(x)$ equal the mirror function.
Let $(x, f(x))$ equal the perpendicular point.
Let $(c, a(c))$ equal the original point.
Let $(d, b(d))$ equal the mirror point.
The x and y component differences must be equal between the mirror point and the other two points. $$c-x=x-d$$ $$c+d=2x$$ $$a(c)-f(x)=f(x)-b(d)$$ $$a(c)+b(d)=2f(x)$$ Starting with just the three functions, we do not know which points correlate. Begin with $(x, f(x))$ and go from there. Find the intersection between the perpendicular line and the original and mirror function. Then to check for symmetry, confirm the above equations.
$$\frac{f(x)-a(c)}{x-c}=\frac{-1}{f'(x)}$$ $$f'(x)(f(x)-a(c))=-1(x-c)$$ $$f'(x)f(x)-f'(x)a(c)=c-x$$ $$f'(x)a(c)+c=f'(x)f(x)+x$$ $$f'(x)b(d)+d=f'(x)f(x)+x$$ Solve for $c$ and $d$ as necessary.
As an example let's prove that a function and its inverse are mirrored over $f(x)=x$. $f'(x)=1$ $$a(c)=g(c)$$ $$b(d)=g^{-1}(d)$$ $$1*g(c)+c=1*x+x$$ $$g(c)+c=2x$$ $$g^{-1}(d)+d=2x$$ The equations to prove with what we have so far are: $$c+d=2x$$ $$g(c)+g^{-1}(d)=2x$$ The definition of an inverse could be said to be switching the $x$ and the $y$ values. That means: $$g(c)=d$$ $$g^{-1}(d)=c$$ Plugging those into the equations we get: $$c+d=2x$$ $$g(c)+g^{-1}(d)=2x$$ Therefore proven.
Creating a function of symmetry:
Using the equations in the last section: $$f'(x)a(c)+c=f'(x)f(x)+x$$ $$f'(x)b(d)+d=f'(x)f(x)+x$$ $$c+d=2x$$ $$a(c)+b(d)=2f(x)$$ $$f(x)=\frac{a(c)+b(d)}{2}$$ $$f(x)=\frac{a(c)}{2}+\frac{b(d)}{2}$$ $$f'(x)=\frac{a'(c)}{2}+\frac{b'(d)}{2}$$ $$(\frac{a'(c)}{2}+\frac{b'(d)}{2})a(c)+c=(\frac{a'(c)}{2}+\frac{b'(d)}{2})f(x)+x$$ $$(a'(c)+b'(d))\frac{a(c)}{2}+c=(a'(c)+b'(d))\frac{f(x)}{2}+x$$ $$(a'(c)+b'(d))a(c)+2c=(a'(c)+b'(d))f(x)+2x$$ $$(a'(c)+b'(d))f(x)=(a'(c)+b'(d))a(c)+2c-2x$$ $$f(x)=a(c)+\frac{2c-2x}{a'(c)+b'(d)}$$ $$f(x)=b(d)+\frac{2d-2x}{a'(c)+b'(d)}$$ $$a(c)+\frac{2c-2x}{a'(c)+b'(d)}=b(d)+\frac{2d-2x}{a'(c)+b'(d)}$$ $$a(c)(a'(c)+b'(d))+2c-2x=b(d)(a'(c)+b'(d))+2d-2x$$ $$a(c)(a'(c)+b'(d))+2c=b(d)(a'(c)+b'(d))+2d$$ Now we have a relation that we can use to determine corresponding points.
Lets use $a(x)=x^2$ and $b(x)=x$ as an example. $a'(x)=2x$ $b'(x)=1$ $$c^2(2c+1)+2c=d(2c+1)+2d$$ $$2c^3+c^2+2c=2cd+d+2d$$ $$2c^3+c^2+2c=2cd+3d$$ $$2c^3+c^2+2c=d(2c+3)$$ $$d=\frac{2c^3+c^2+2c}{2c+3}$$ The point $(x, f(x))$ must be at the midpoint of $(c, a(c))$ and $(d, b(d))$. $$f(x)=\frac{a(c)+b(d)}{2}$$ $$f(x)=\frac{c^2+d}{2}$$ $$f(x)=\frac{c^2+\frac{2c^3+c^2+2c}{2c+3}}{2}$$ $$x=\frac{c+d}{2}$$ $$x=\frac{c+\frac{2c^3+c^2+2c}{2c+3}}{2}$$ Our goal should be to get $f(x)$ in terms of $x$. $$2x=c+\frac{2c^3+c^2+2c}{2c+3}$$ $$2x-c=\frac{2c^3+c^2+2c}{2c+3}$$ $$f(x)=\frac{c^2+2x-c}{2}$$ $$f(x)=x+\frac{c^2-c}{2}$$ Now we would need to solve for $c$ directly to solve for the function of symmetry, however it is a cubic and hard to solve for: $$2x-c=\frac{2c^3+c^2+2c}{2c+3}$$ You can use a method of approximation like the one I used earlier to find points along the function of symmetry, but to find the equation you would have to solve directly. $$(2x-c)(2c+3)=2c^3+c^2+2c$$ $$4xc+6x-2c^2-3c=2c^3+c^2+2c$$ $$2c^3+3c^2+5c-4xc=6x$$ $$2c^2+3c+5-4x=\frac{6x}{c}$$ $$c^2+\frac{3c}{2}+\frac{5}{2}-2x=\frac{3x}{c}$$ $$c^2+\frac{3c}{2}=\frac{3x}{c}+2x-\frac{5}{2}$$ $$c^2+\frac{3c}{2}+(\frac{3}{4})^2=\frac{3x}{c}+2x-\frac{5}{2}+(\frac{3}{4})^2$$ $$(c+\frac{3}{4})^2=\frac{3x}{c}+2x-\frac{5}{2}+\frac{9}{16}$$ $$c+\frac{3}{4}=\sqrt{\frac{3x}{c}+2x-\frac{40}{16}+\frac{9}{16}}$$ $$c=\frac{-3}{4}+\sqrt{\frac{3x}{c}+2x-\frac{31}{16}}$$ Condensed Summary: $$a(c)(a'(c)+b'(2x-c))+4c=b(2x-c)(a'(c)+b'(2x-c))+4x$$ Solve for $c$ and plug $c$ into $$f(x)=x+\frac{c^2-c}{2}$$ This can also be used as a method of detecting symmetry.


How do we define 'mirroring' or reflection across a line? If you have a line $\ell$ and a point $A$, the image of $A$ across $\ell$ is constructed by dropping a perpendicular from $A$ onto $\ell$, and doubling it (i.e. extending it by its own length) on the other side of $\ell$ to get a point $A'$ at the end of the segment. Reflection across a point $O$ is even simpler. To obtain the image of $A$, join $A$ and $O$ and double that segment, to get $A'$ at the end of the doubled segment.

We can define reflection across a circle, too: this is called inversion and it has many interesting properties. The same technique can be extended to a three-dimensional circle (a sphere), a four-dimensional circle, etc.

Note that all these 'reflections' have some common properties:

  • Every point which has an image, has a unique image. (And with a little stretching of the concepts of geometry (eg. by introducing a point/line at infinity), you can even say that every point has an image.)
  • If $A'$ is the image of $A$, then $A$ is the image of $A'$ in the same reflection.
  • If a continuous function/locus/graph is reflected, the image is still continuous.

Suppose you wanted to define reflection across an arbitrary curve. To make things simpler, let's assume that this curve is actually a function of $x$ in the Cartesian plane. Obviously, a method of reflection like that for a point is not going to work. If we try to use the method for a line, we find that 'the perpendicular' from a point to an arbitrary curve is not unique -- in fact, whenever the curve is not a line (i.e. whenever the tangents to the curve at some two different points are not parallel), there will be at least one point with at least two perpendiculars of the same length. This violates all the three common properties.

Similarly, we cannot use the inversion method because that depends heavily on the [relatively nice] properties of a circle. In general, we do not know of a method of reflection that works for arbitrary curves and satisfies the three properties which, if you think about them, are quite reasonable expectations.

  • $\begingroup$ Thank you for your comment . May you read my comment on the question and correct me ? $\endgroup$ Jun 24, 2016 at 6:29
  • $\begingroup$ @WaleedMustafa According to your definition, a point and a line would be mirror images across a line equidistant from them! $\endgroup$
    – shardulc
    Jun 24, 2016 at 6:33

I actually had the same idea back in early 2015 when I first learned about inverse functions. So, almost a decade later I finally found some time to actually write a Python script that does just that (for any two given 2D real-valued parametric curves in the Cartesian plane, where at least one of them must be differentiable in at least one point). You can find the up-to-date code here.

The code operates by performing the following main steps:

  • Evaluating the derivative of the mirror curve at each point*.
  • Determining the intersections between each perpendicular line* to the tangents of the mirror curve and the to-be-mirrored curve**.
  • Flipping the vectors that connect the intersection points with the point on the mirror curve from where the perpendicular line was cast.

*Considering that, in general, it is impossible to compute the derivative for an infinite number of points within a finite time, the code provides the capability to define intervals of the parameter that generates the curve and adjust the point density within those intervals.

**The to-be-mirrored curve might be defined by any two parametric expressions, but the existence of an exact solution set for a system consisting of an affine equation and a nonlinear non-affine equation relies on the nature of the equations and their properties. In certain cases, numerical methods or approximation techniques are necessary to find solutions. However, a system of affine equations always possesses a set of analytic solutions; that's why in the code the to-be-mirrored curve is approximated by a set of line segments. Additionally, by increasing the point density in the range of the to-be-mirrored curve parameter, we can approach the original curve arbitrarily closely, except maybe for unusual curves like the Weierstrass function and some piecewise defined curves.

Please note that the steps mentioned above describe the basic procedure of the code, but the actual implementation involves additional considerations and optimizations.

Finally, the code generates a plot showcasing the two parametric curves along with the symmetric curve. This plot is saved in the folder where the script was executed. Additionally, a .csv file is generated containing the coordinates of the points of the mirrored curve, allowing you to easily export the data if needed.

If this definition of symmetry is acceptable or not is up for debate, as stated by @shardulc in his answer. Nevertheless, I think it is reasonable enough from a purely graphical geometric perspective.

Here are some cool-looking examples (the purple one is the mirrored curve, whilst the mirror and the to-be-mirrored curve don't follow any particular color scheme): enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

Another approach to achieving curve-to-curve symmetry is presented by Robert March in his work. However, this method utilizes a different definition of symmetry, leading to different outcomes compared to the one implemented in my script.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .