Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given a generic expression of a conic:

$$Ax^2 + Bxy + Cy^2 + Dx + Ey + F=0$$

is there a way to write an expression for one of the branches as a function of the coefficients? I tried using the quadratic formula to get an expression for $y$: $$y=\frac{-(Bx+E)\pm \sqrt{(Bx+E)^2 - 4(C)(Ax^2 + Dx + F)}}{2C}$$

but this doesn't always work. Consider:


Here, $A=0, B=1, C=0, D=0, E=0, F=0$, so $y=\frac{\cdot}{0}$, which isn't particularly helpful. In other cases it is not as bad, but still not what I'm looking for. E.g.

$$x^2 - y^2 - 1=0$$

Using the formula above, we get $$y=\pm \sqrt{x^2-1}$$ which seems nice, but $y=\sqrt{x^2-1}$ it is actually one half of each branch rather than one entire branch, as can be seen here.^2+-+y^2+-+1%3D0%29^2-1%29%29

I am trying to draw one of these branches, so I need an ordered set of points along a predefined "grid" of either of the variables. Is it possible to do this?

share|cite|improve this question
Your equation doesn't work for all hyperbolas since you found it as a solution of quadratic equation. For $xy = 1$ it won't work since it's not quadratic equation. You can't solve $0x^2+2x+1=0$ as quadratic equation, since it's not. – Kaster Mar 7 '13 at 23:56

First of all, if you want to draw a portion of the hyperbola, you typically just need parametric equations of the form $x = x(t)$, $y = y(t)$; you don't necessarily need to get $y$ as a function of $x$.

But, ignoring that quibble, I'll try to answer the question you asked.

The key is to first eliminate the $xy$ term in the implicit equation. In effect, you do this by rotating the coordinate system. This is really the same idea as Will Jagy used in his answer, but it might be easier to understand if I don't mention eigenvectors.

Suppose we introduce a $uv$ cooordinate system that is rotated by an angle $\theta$ (counterclockwise) from the $xy$ one. Then we have

$$x = u\cos\theta - v\sin\theta \quad ; \quad y = u\sin\theta + v\cos\theta$$

You can plug these $x$ and $y$ expressions into your original equation, and you'll get

$$\bar A u^2 + \bar B uv + \bar C v^2 + \bar Du + \bar Ev + \bar F = 0 $$


$$\bar A = A \cos^2\theta + 2B \sin \theta\cos\theta + C \sin^2\theta $$

$$\bar B = 2 B \cos 2\theta - (A - C) \sin 2\theta $$

$$\bar C = A \sin^2\theta - 2B \sin\theta\cos\theta + C \cos^2\theta $$

and so on. Now we just have to cleverly choose $\theta$ so that the $uv$ term disappears. Clearly, we'll get what we want if we choose $\theta$ so that $\bar B = 0$, and this means

$$ \tan2\theta = \frac{2B}{A - C}$$

After using this technique, we can now assume that the equation has the form

$$a u^2 + c v^2 - 2adu - 2cev + f = 0 $$

Note that I'm using $-2ad$ in place of $\bar D$ and $-2ce$ in place of $\bar E$, just to make the next step more convenient. And the next step is just some "complete the square" tricks. The equation can be written:

$$a (u^2 - 2du) + c (v^2 - 2ev) + f = 0 $$

In other words:

$$a (u^2 - 2du + d^2) + c (v^2 - 2ev + e^2) + f - ad^2 - ce^2 = 0 $$

which is

$$a (u - d)^2 + c (v - e)^2 = ad^2 + ce^2 - f $$

Now it should be clear that we have either an ellipse (if the signs of $a$ and $c$ are the same) or a hyperbola (if the signs are different). I'm ignoring the parabola case and several degenerate cases. The ellipse/hyperbola has its center at the point $(d,e)$ in the $uv$ coordinate system, and its axes of symmetry are parallel to the $u$ and $v$ axes.

At this point, if our curve turns out to be a hyperbola, you can use standard parametric equations (like the ones Wil Jagy gave) to trace out one branch or the other.

share|cite|improve this answer

I think you are going to have a more satisfactory experience doing this: find the center $\vec{P} = (x_0, y_0)$ of your hyperbola. Find the eigenvectors of the matrix $$ \left( \begin{array}{cc} A & B/2 \\ B/2 & C \end{array} \right) $$ and normalize and choose order and $\pm$ so that with basis $\vec{u},\vec{v}$ you can then write your branch as $$ g(t) = \vec{P} + \vec{u} \cosh t + \vec{v} \sinh t. $$ Note that while $\vec{u},\vec{v}$ are perpendicular to each other they are not particularly of any length, in the way I write it above. If you prefer an orthonormal basis you then just put one constant scalar multiplication in front of the $\cosh$ term and one in front of the $\sinh$ term. It will all work out if you actually do have a hyperbola, which happens when $B^2 > 4 A C.$

I did teach this about 20 years ago, a whole section on translations and rotations of conic sections for a engineering calculus course. The memories are dim, but it does appear that it is best to find an orthonormal basis for the above matrix first, then find the center expressed in that basis, and end up with constant scalar coefficients of the hyperbolic trig terms.

share|cite|improve this answer
I posted an answer following your suggestion with an example. The only part I didn't follow was "and normalize and choose order and $\pm$ so that with the new basis you can then write your branch as...". What do you mean "choose order" and "choose $\pm$"? Also, how do you determine the values of the parameter that constitute each branch? – David Doria Mar 8 '13 at 13:31

Following Will Jagy's suggestion, here are some examples:

Example #1


$$x^2 - y^2 -1 = 0$$ enter image description here

($A=1$, $B=0$, $C=-1$, $D=0$, $E=0$, $F=-1$). From

$$p_c = \begin{pmatrix}x_c\\y_c\end{pmatrix} = \begin{pmatrix}\frac{BE-2CD}{4AC-B^2}\\ \frac{DB-2AE}{4AC-B^2}\end{pmatrix}$$

we have

$$p_c = \begin{pmatrix}0\\0\end{pmatrix}$$

Now, the eigenvalues/vectors of the matrix $$\begin{pmatrix}A & \frac{B}{2}\\\frac{B}{2} & C\end{pmatrix} = \begin{pmatrix}1 & 0 \\ 0 & -1 \end{pmatrix}$$ are $\lambda_1 = -1$, $\lambda_2 = 1$, $v_1 = \begin{pmatrix}0\\1\end{pmatrix}$, $v_2 = \begin{pmatrix}1\\0\end{pmatrix}$

From the parametric form

$$g(t)=p_c + v_1 cosh(t) + v_2 sinh(t)$$

we have

$$g(t) = \begin{pmatrix}0\\1\end{pmatrix} cosh(t) + \begin{pmatrix}1\\0\end{pmatrix} sinh(t)$$

which looks like enter image description here

Now how would we draw the other branch? That is, how do you determine the values of the parameter that constitute each branch?

Example #2


$$7x^2 - 3y^2 - 25 = 0$$

($A=7$, $B=0$, $C=-3$, $D=0$, $E=0$, $F=-25$). From

$$p_c = \begin{pmatrix}x_c\\y_c\end{pmatrix} = \begin{pmatrix}\frac{BE-2CD}{4AC-B^2}\\ \frac{DB-2AE}{4AC-B^2}\end{pmatrix}$$

we have

$$p_c = \begin{pmatrix}0\\\frac{-25}{6}\end{pmatrix}$$

Now, the eigenvalues/vectors of the matrix $$\begin{pmatrix}A & \frac{B}{2}\\\frac{B}{2} & C\end{pmatrix} = \begin{pmatrix}7 & 0 \\ 0 & -3 \end{pmatrix}$$ are $\lambda_1 = -3$, $\lambda_2 = 7$, $v_1 = \begin{pmatrix}0\\1\end{pmatrix}$, $v_2 = \begin{pmatrix}1\\0\end{pmatrix}$

From the parametric form

$$g(t)=p_c + v_1 cosh(t) + v_2 sinh(t)$$

we have

$$g(t) = \begin{pmatrix}0\\ \frac{-25}{6}\end{pmatrix} + \begin{pmatrix}0\\1\end{pmatrix} cosh(t) + \begin{pmatrix}1\\0\end{pmatrix} sinh(t)$$

share|cite|improve this answer
David, the other branch is $p_c -v_1 \cosh t + v_2 \sinh t$ – Will Jagy Mar 8 '13 at 20:51
David, please do another example, something along the lines of $x^2 - x y - y^2 =1,$ where the eigenvectors will not naturally come out length one, and if you choose an orthonormal basis you will need scalar multiples, $p_c + \alpha v_1 \cosh t + \beta v_2 \sinh t.$ Note that the bit about the scalar multipliers would apply even for, say, $7 x^2 - 3 y^2 = 25,$ where one branch is $$ x = \frac{5}{\sqrt 7} \cosh t, y = \frac{5}{\sqrt 3} \sinh t. $$ – Will Jagy Mar 8 '13 at 21:04
@WillJagy How do you choose the eigenvector that goes with cosh vs sinh? Even in my Example #1, the hyperbola opens up/down (instead of left/right) if I use x=sinh(t) and y=cosh(t) as the eigenvectors they way I have written them imply (I guess I thought I had made a typo so I switched them (x=cosh(t) and y=sinh(t) when I produced that graph):… – David Doria Mar 11 '13 at 12:04
@WillJagy I worked out the $7x^2 - 3y^2 - 25 = 0$ example in my answer. How did you get from where I am to the $\frac{5}{\sqrt{7}}$ and $\frac{5}{\sqrt{3}}$ coefficients? And did you just accidentally omit the $center + ...$ term? My comment above holds on this problem as well - how do you choose the eigenvector to associate with the cosh vs sinh term? – David Doria Mar 11 '13 at 12:11
The center is actually at $(0,0)$ because $D=0,E=0.$ If you choose unit length eigenvectors, then you expect scalar coefficients to be necessary. In particular, try your recipe at $t=0$ (after replacing the -25/6 by 0) and you will find the point does not lie on the actual hyperbola. How about if you try doing $xy = 1?$ You already know exactly how the graph looks. One test for correctness is, once you write $x = x_c + x_1 \cosh t + x_2 \sinh t,$ then $y = y_c + y_1 \cosh t + y_2 \sinh t,$ you must be able to plug those into the original equation and get truth. – Will Jagy Mar 11 '13 at 20:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.