# How to find the corner point of a non-function equation?

Consider the equation

$$-242.0404+0.26639x-0.043941y+(5.9313\times10^{-5})\times xy-(3.9303\times{10^{-6}})\times y^2-7000=0$$

with $$x,y>0$$. If you plot it, it'll look like below:

Now, I want to find the corner point/inflection point in this equation/graph, which roughly should be somewhere here. This is my manually pinpointed approximation, using my own eyes:

Any help on how to mathematically find this point would be really helpful.

UPDATE Based on Adrian's answer, I've got the following $$(1.1842*10^{-4},0.6456*10^{-4})$$ (wondering what can cause this slight error?):

The actual corner point seems a little bit far from the one found by Adrian's approach (why?):

Update 2 The problem was the aspect ratio of my drawing, I fixed the aspect ratio and Adrian's answer looks pretty accurate:

• Comments are not for extended discussion; this conversation has been moved to chat. Jun 27, 2019 at 18:38

## 3 Answers

Following Calvin Khor's line of reasoning, we will use the following algorithm:

1. Find the center of the hyperbola, and translate the hyperbola so that the center coincides with the origin.
2. Find the angle of rotation necessary to put the hyperbola into the canonical form $$x^2/a^2-y^2/b^2=1.$$
3. The corner points are represented, at this point, by $$x=\pm a.$$
4. Rotate these two points back through the angle found in Step 2.
5. Translate these two points back through the translation performed in Step 1.

The wikipedia page on the general hyperbola will be our guide, here.

Step 1. According to the wiki page, we must write the hyperbola in the form $$A_{xx}x^2+2A_{xy}xy+A_{yy}y^2+2B_xx+2B_yy+C=0.$$ We have $$0x^2+\left(5.9313\times 10^{-5}\right)xy-\left(3.9303\times 10^{-6}\right)y^2 + 0.26639x-0.043941y-7242.0404=0,$$ making \begin{align*} A_{xx}&=0 \\ A_{xy}&=\left(5.9313\times 10^{-5}\right)/2=2.96565\times 10^{-5} \\ A_{yy}&=-3.9303\times 10^{-6} \\ B_x&=0.26639/2=0.133195 \\ B_y&=-0.043941/2=-0.0219705 \\ C&= -7242.0404. \end{align*} We check for the hyperbola nature, namely, that $$D=\left|\begin{matrix}A_{xx}&A_{xy}\\ A_{xy} &A_{yy} \end{matrix}\right|<0,\quad\text{or}\quad D=\left|\begin{matrix}0&2.96565\times 10^{-5}\\ 2.96565\times 10^{-5} &-3.9303\times 10^{-6} \end{matrix}\right|=-8.79508\times 10^{-10}<0,$$ which is clearly true. The center $$(x_c,y_c)$$ of the hyperbola is given by \begin{align*} x_c&=-\frac{1}{D}\left|\begin{matrix}B_x &A_{xy}\\ B_y &A_{yy}\end{matrix}\right| =\frac{1}{8.79508\times 10^{-10}}\left|\begin{matrix}0.133195 &2.96565\times 10^{-5}\\ -0.0219705 &-3.9303\times 10^{-6}\end{matrix}\right|=145.618\\ y_c&=-\frac{1}{D}\left|\begin{matrix}A_{xx} &B_x\\ A_{xy} &B_y\end{matrix}\right| =\frac{1}{8.79508\times 10^{-10}}\left|\begin{matrix}0 &0.133195\\ 2.96565\times 10^{-5} &-0.0219705\end{matrix}\right|=-4491.26.\end{align*}

Step 2. The angle of rotation is given by \begin{align*} \tan(2\varphi)&=\frac{2A_{xy}}{A_{xx}-A_{yy}} \\ \varphi&=\frac12\,\arctan\left(\frac{2A_{xy}}{A_{xx}-A_{yy}}\right)=0.752315\,\text{rad}=43.1045^{\circ}, \end{align*} which definitely looks about right.

Step 3. The formula for $$a^2$$ is $$a^2=-\frac{\Delta}{\lambda_1 D},$$ where \begin{align*} \Delta&=\left|\begin{matrix}A_{xx}&A_{xy}&B_x\\A_{xy}&A_{yy}&B_y\\B_x&B_y&C\end{matrix}\right|=6.26559\times 10^{-6} \\ 0&=\lambda^2-(A_{xx}+A_{yy})\lambda+D. \end{align*} Unfortunately, the wiki page fails to distinguish between $$\lambda_1$$ and $$\lambda_2$$. If we examine the signs, we must have $$a^2>0,$$ which means, since $$D<0$$ and $$\Delta>0,$$ we must pick the positive root. We have \begin{align*} \lambda_2&=-3.16867\times 10^{-5}\\ \lambda_1&=2.77564\times 10^{-5}, \end{align*} so that $$a=\pm 16020.6.$$ Step 4. The point we need to rotate is $$(16020.6, 0)$$ counter-clockwise through an angle $$\varphi=0.752315\,\text{rad}$$. The rotation matrix for doing that is given by $$R=\left[\begin{matrix}\cos(\varphi)&-\sin(\varphi)\\ \sin(\varphi) &\cos(\varphi)\end{matrix}\right]=\left[\begin{matrix}0.730109&-0.683331\\ 0.683331 &0.730109\end{matrix}\right].$$ After rotating, the point is located at $$(11696.8, 10947.4).$$

Step 5. This is the moment of truth! We must translate back to the original coordinate system. The center of the original hyperbola was located at $$(145.618, -4491.26).$$ What we must do is add the coordinates together to get the un-translated version. The final point is located at $$(11842.4, 6456.14).$$

This is not too far off from my other answer! We check to make sure this point is on the curve

$$x=\frac{7242.0404+\left(3.9303\times{10^{-6}}\right) y^2+0.043941y}{0.26639+\left(5.9313\times10^{-5}\right)\!y},$$ and it is. So I say that this point is the "corner" of your graph.

• Thank you so much @AdrianKeister. This is definitely a very detailed and great answer. I've actually implemented your approach using Matlab and it gives a "VERY CLOSE" coordinates. I've updated my answer and uploaded a new image with the point that your approach finds. Do you have any idea why it has a little bit error? (maybe its because of floating points?) Jun 28, 2019 at 7:22
• I checked the coordinates and its the same as yours. So, it's not the floating points or code. Wondering what can cause this slight error (or maybe there is no? To me its a little bit far from the actual corner point). Jun 28, 2019 at 7:35
• I triple checked and it seems it doesn't give the correct corner point. I've updated my answer again Jun 28, 2019 at 8:40
• I quadruple checked it, you mentioned an important point in your other answer that I missed: "the aspect ratios should be the same"...I did, and the asnwer is now correct. Thank you so much! Jun 28, 2019 at 9:05
• @AdrianKeiser is this approach also true for parabolas instead of hyperbolas? Jul 1, 2019 at 22:58

We first simplify the expression, and then solve for $$x:$$ \begin{align*} -242.0404+0.26639x-0.043941y+\left(5.9313\times10^{-5}\right)xy-\left(3.9303\times{10^{-6}}\right) y^2-7000&=0 \\ 0.26639x-0.043941y+\left(5.9313\times10^{-5}\right)xy-\left(3.9303\times{10^{-6}}\right) y^2-7242.0404&=0 \end{align*} \begin{align*} x\left[0.26639+\left(5.9313\times10^{-5}\right)\!y\right]&=7242.0404+\left(3.9303\times{10^{-6}}\right) y^2+0.043941y \\ x&=\frac{7242.0404+\left(3.9303\times{10^{-6}}\right) y^2+0.043941y}{0.26639+\left(5.9313\times10^{-5}\right)\!y}. \end{align*} We see that $$x$$ is a function of $$y$$, with domain all real numbers except $$-0.26639/\left(5.9313\times 10^{-5}\right).$$ Just invert the function (corresponds to reflecting about the line $$y=x$$). We have $$y(x)=\frac{7242.0404+\left(3.9303\times{10^{-6}}\right) x^2+0.043941x}{0.26639+\left(5.9313\times10^{-5}\right)\!x}.$$ I would say that the corner you're after is a point where $$y'(x)=-1$$. So we have $$y'(x)=\frac{-1.18771\times 10^{8}+595.215x+0.0662637x^2}{(4491.26+x)^2}.$$ Setting $$y'(x)=-1$$ and solving for $$x,$$ we find that $$x=-15104.6,\;6122.12,$$ with corresponding $$y=-11874.4,\; 12165.6,$$ respectively. So the point you're after (swapping $$x$$ and $$y$$ again) is $$(12165.6, 6122.12).$$ Incidentally, if you're "eyeballing it", you should be aware that the aspect ratio of your graph will greatly influence where you think the corner is. I recommend forcing an aspect ratio of $$1,$$ before you say where you think the corner is.

• Thank you @AdrianKeister. You saved me :-) Jun 29, 2019 at 8:07

You could also use more high powered maths as follows.

a) Find a parametrization $$t \mapsto \gamma(t)=(x(t), y(t))$$ of your curve.

b) Reparametrize to get a cuve parametrized by arc length, that is $$x'(t)^2+y'(t)^2=1$$ for all $$t$$.

c) Compute the curvature $$\left\|\gamma''(t)\right\|$$

d) The point you are looking for is the point with maximum curvature

The wikipedia page https://en.wikipedia.org/wiki/Curvature explains this in more detail. The answer should be exactly the same as the given by Adrian Keister.

• Thanks for the answer. I appreciate it. Do you have any tips on how to extract the parametrized form my current equation? Jun 28, 2019 at 9:00