Putting a hyperbola in standard form

Since my last thread , I’ve done quite a bit of research into hyperbolae and conic sections. Not being a “math person,” some of it is over my head, but I remember enough algebra and trig to piece my way through. Rather than throw another list of questions out there, I’m trying to show the specific steps I’m taking to render a given hyperbola in standard form, hoping some of the finer math minds here on the board will be able to help me where I’m going wrong and provide any insights.

Specifically, I’m dealing with hyperbolae that fit the following form:

(1): y = (a + x[sup]2[/sup])/(b - x)

…where a and b are both positive integers. Again, for the purposes of this thread, the only hyperbolae I’m interested in fit this form.

Most of the references I have deal with hyperbolae in the following forms:

(2): Ax[sup]2[/sup] + Bxy + Cy[sup]2[/sup] + Dx + Ey + F = 0

…where B[sup]2[/sup] > 4AC

And:

(3): (y[sup]2[/sup]/a’ [sup]2[/sup]) - (x[sup]2[/sup]/b’ [sup]2[/sup]) = 1

…when the foci are on the y axis, or parametrically:

x = a’ * sec(t)
y = b’ * tan(t)

So, the goal here is to express (1) as (3) in terms of the original variables a and b

Step 1, in which we try to put (1) into standard form (2):

(a + x[sup]2[/sup])/(b - x) = y
a + x[sup]2[/sup] = y(b - x)
a + x[sup]2[/sup] = by - xy
x[sup]2[/sup] + xy - by + a = 0

…so far so good. That gives us fixed values for parameters A through D in (2):

A, B = 1
C, D = 0
E = -b
F = a

Step 2, in which we calculate the hyperbola’s angle of rotation, theta:

The rule I’ve seen (from a reference site ):

if (A == C) theta = pi/4
else theta = 0.5 * atan(B / (A - C));

so:

theta = 0.5 * atan(1) = 0.39269908169872414 radians =~ 22.5 degrees

Given that A, B, and C are constant for all my hyperbolae, the rotation will be constant, too, correct?

Step 3, in which we calculate the coefficients with the rotation removed:

A’ = (A * cos(theta)[sup]2[/sup]) + (B * sin(theta) * cos(theta)) + (C * sin(theta)[sup]2[/sup])
C’ = (A * sin(theta)[sup]2[/sup]) - (B * sin(theta) * cos(theta)) + (C * cos(theta)[sup]2[/sup])
D’ = (D * cos(theta)) + (E * sin(theta))
E’ = (-D * sin(theta)) + (E * cos(theta))
F’ = F

Since we know theta:

sin(theta) = 0.3826834323650898
cos(theta) = 0.9238795325112867

A’ = 1.2071067811865475
C’ = 1.2071067811865475
D’ = -b * sin(theta)
E’ = -b * cos(theta)
F’ = a

At this point, we’ve simply removed the rotation (B) coefficient.

Step 4, in which we calculate the center (x[sub]o[/sub],y[sub]o[/sub]):

x[sub]o[/sub] = -D’/2A’ = -(-b * sin(theta))/(2 * 1.2071067811865475) = (b * sin(theta)) / 0.414213562373095
y[sub]o[/sub] = -E’/2C’ = -(-b * cos(theta))/(2 * 1.2071067811865475) = (b * cos(theta)) / 0.414213562373095

So far, so good? And since we’ve only de-rotated the hyperbola, this is also the center of the original, yes? So, given the center, we should be able to translate the shape such that the new center is (0,0) by simply moving it -x and -y?

Step 5, in which we calculate the co-efficients A" and B" of the hyperbola in standard form:

q = (A’ * x[sub]o[/sub][sup]2[/sup]) + (C’ * y[sub]o[/sub][sup]2[/sup]) - F’
A" = A’/q
C" = C’/q

to reveal the standard conic:
A"x[sup]2[/sup] + C"y[sup]2[/sup] - 1 = 0
**
Step 6**, in which we calculate the standard conic:

So looking to put our equation into the standard form of a hyperbola above (3), we calculate:

a’ [sup]2[/sup] = 1 / min(|A"|,|B"|)
b’ [sup]2[/sup] = 1 / max(|A"|,|B"|)

let c = sqrt(a’ [sup]2[/sup] - b’ [sup]2[/sup])

then if (|A"| < |C"|) foci are at (±c, 0)
else foci are at (0,±c)

and the eccentricity = c / a’

At least, I think that’s right. Again, the whole point is to be able to express a’ and b’ from (3) in terms of a and b from (1), externalizing the rotation, translation, and eccentricity into separate variables. I feel confident the rotation will always be the same (~22.5 degrees). I have reason to believe the eccentricity will also be constant for hyperbolae that fit (1), but I’m not able to prove it. I also suspect but am unable to prove that the foci of the standardized hyperbolae will always be on the y-axis. I’m also having trouble visualizing exactly what eccentricity is: the word “skew” comes to mind, but it’s not very precise. My working theory is that, in terms of an affine transform, eccentricity would be analogous to shear in one dimension.

A few general comments:

First, on the rotation necessary to reduce the hyperbola to the canonical form (3): You can easily see from (1) what the asymptotes to the hyperbola are. For |x| very large, (1) is approximately y~=-(x+b); this is one of the asymptotes. The other asymptote is the vertical line x=b (for which y becomes infinite). In form (3), the asymptotes are symmetric about the y axis, so we need to rotate by 22.5° clockwise to achieve that form. (To show that you don’t actually want to rotate by 67.5° ccw you have to see which halves of the asymptotes are connected, but it’s not hard to convince yourself which way is right.)

The center of the hyperbola is the point of intersection of the asymptotes, so that part is easy enough too. (Unfortunately, I can’t think of any easy way of finding the foci without doing the calculations.)

In steps 5 and 6 there seems to be a variable which changes names, B’’ vs. C’’. More important is your definition (step 6) of a’ and b’, which I think is wrong. In (3), note that the signs of the coefficients of x[sup]2[/sup] and y[sup]2[/sup] are different. In the form (3), the hyperbola opens upward/downward, because the coefficient of y[sup]2[/sup] is positive. Your choice of rotation angle guarantees that the hyperbola has this form at the end of step 5,
A’‘x[sup]2[/sup]+C’‘y[sup]2[/sup]-1=0.
That is, this equation should have C’’>0 and A’’<0. Now just define (a’)[sup]2[/sup]=1/C’’ and (b’)[sup]2[/sup]=-1/A’’.

Your equation for the semifocal length c is wrong (you’ve got the formula for an ellipse, not for a hyperbola). For a hyperbola
c[sup]2[/sup]=(a’)[sup]2[/sup]+(b’)[sup]2[/sup]
(note the + sign).

The eccentricity of a hyperbola (e=c/a’) is a measure of its shape (you can think of it as a measure of the shear from a standard shape if you like). e>1 always; small e (close to 1) indicates a hyperbola with a narrow “opening”; large e indicates one with a broad opening. Because all of your hyperbolae have the same angle between asymptotes (45°) they should have the same eccentricities.

What is the goal here? If a and b are actually integers, this sounds like a Diophantine problem (especially with your question about integral solutions, in the previous post). I’m not sure whether the forms (2) and (3) are more useful for Diophantine solutions than the original form.

Gah!

Step 5 should be: in which we calculate A" and C" of the hyperbola in standard form

Step 6 should read:

a’ [sup]2[/sup] = 1 / min(|A"|,|C"|)
b’ [sup]2[/sup] = 1 / max(|A"|,|C"|)

let c = sqrt(a’ [sup]2[/sup] + b’ [sup]2[/sup])

:smack:

You rock my world, Omphaloskeptic. I’m aware that the fact that the hyperbola opens upwards/downwards because the y[sup]2[/sups] coefficient is positive. The reason I chose that form is because the hyperbola was more vertically oriented as (1); what I wasn’t sure of was that any instance of (1) would necessarily always be that way. Your insight about the asymptotes helped a lot. I knew x=b was one of them; I didn’t realize they would always have 45 degrees between them. So the eccentricity and rotation would always be the same. I’m getting a number around 1.0824 for the eccentricity. The translation is the only parameter that will vary.

What is the goal here? That’s a very good question. Yes, integral solutions would be very nice. As far as being a diophantine equation: the important solutions aren’t only integral–though there are definitely at least a few–and knowing them would certainly be nice, but not necessary.

The reason for this exercise is that most of the available material I have references the hyperbola as (3) (or with the coefficients’ signs reversed), and so I need a way to express a’ and b’ in terms of the only two variables I know, a and b from (1), which are always integers. But I understand that by the time I move the hyperbola into standard form that the integral ship has sailed (maybe the rational ship, too). Another developer I’m working with has already written a lot of code that uses parametric functions; in order to use them, I need to be able to render the hyperbolae in standard form.

Ah…what I should have said was that it looks like the absolute value of the angle of rotation from the y-axis will always be smaller from the absolute value of the angle of rotation from the x-axis. In otherwords, the smallest abs. rotation you’d have to make to standardize it would be to the y-axis (which I guess that x=b asymptote should make obvious)…

Ahh the OP brings up a lot of dark and painful memories.

Your value for C’ is wrong here (the formula is correct; just a wrong number); it should be -0.2071… . (If you care, you can come up with algebraic expressions for A’ and C’. Because theta=22.5° is a rational angle, sin(theta) and cos(theta) are algebraic; in fact sin[sup]2/sup=(sqrt(2)-1)/(2sqrt(2)) and cos[sup]2/sup=(sqrt(2)+1)/(2sqrt(2)), so A’=(1+sqrt(2))/2 and C’=(1-sqrt(2))/2.)

It’s probably easier to do the translation first, though; the hyperbola’s center is (b,-2b), so let x’=x-b and y’=y+2b. Substituting in
0 = x[sup]2[/sup]+xy-by+a
gives
0 = (x’)[sup]2[/sup]+x’y’+a+b[sup]2[/sup]
which is of the same form as (1) but with the replacement (a,b) -> (a+b[sup]2[/sup],0). So now rotation as in step 3 will give
A’ = 1.2071067811865475
C’ = -0.2071067811865475
D’ = 0
E’ = 0
F’ = a+b[sup]2[/sup]

This is unnecessarily confusing. I would just write:

a’ [sup]2[/sup] = 1 / C"
b’ [sup]2[/sup] = -1 / A"

If you’ve done the rotation correctly, this will guarantee an upward-opening hyperbola of the form (3). For example, continuing from the results above we have (inserting absolute-value symbols to show the signs explicitly)
|F’| = |C’|(y’)[sup]2[/sup] - |A’|(x’)[sup]2[/sup]
1 = |C’/F’|(y’)[sup]2[/sup] - |A’/F’|(x’)[sup]2[/sup]
which is in standard form with
a’ [sup]2[/sup] = |F’ / C’|
b’ [sup]2[/sup] = |F’ / A’| .
A little algebra gives
c’ [sup]2[/sup] = F’ (1/A’ - 1/C’) = 4sqrt(2)(a+b[sup]2[/sup]) .

Two things will vary: the translation (the center is at (b,-2b)) and the scaling (the semifocal length c is proportional to a+b[sup]2[/sup]).

You’ve restricted yourself, in your derivation, to rigid coordinate transformations (rotations and translations). Depending on your application, this restriction may not be necessary. If you need a distance-preserving map, rigid transformations are the way to go. But you may be able to use a more general affine transformation, for example, to simplify the equation while maintaining rational solutions (if that’s a desirable feature). The transformation I gave in the prior thread (u=b-x, v=y+x-b) is an example of such a transformation. It has a shear component (along with a translation) which converts the equation into the nice form uv = a+b[sup]2[/sup]. Now if you like you can do a birational transformation into the canonical form (3) that you like. (You could rotate by 45°, but that doesn’t preserve rational solutions; instead rotate by 45° and rescale by sqrt(2).)

What are the requirements on the parametric functions being used? It sound like you’re using the (sec,tan) parametric form you mentioned earlier; is that the only acceptable form?

A few notational questions regarding the following assumptions I’m making:

|x/y| == |x|/|y|
(I don’t see why this wouldn’t be true)

sin[sup]2/sup == sin(x) * sin(x)
(In other words, is it just convention that the exponent trails the function name and not the entire expression?)

Yes, I see the value for C’ was wrong–thank you. The second part is news to me (no surprise there): are you saying that iff theta is rational, sin and cos can be expressed as simple algebraic expressions? Any reference site you could point me to might be helpful.

But can we be certain theta is rational? After all, the value I’m getting rounds to 22.5°, but the value both in radians and degrees is actually a pretty long decimal. I haven’t calculated enough places to discern a period or to see if the decimal terminates.

Crazy! This is very cool…the semifocal length in terms of the original variables. One very minor question: is it also just convention to leave the variable squared? As opposed to saying:

c’ = sqrt( 4sqrt(2)(a+b[sup]2[/sup]) )

…which would be just as true, right?

OK, so now for the big summit push. We know the center is at (b, -2b), we know the semi focal length c’, thus we should be able to find the foci of the original hyperbola, right? For instance, to determine the focus (F[sub]x[/sub], F[sub]y[/sub]) where F[sub]y[/sub] > 0, we’d just translate the center along the y-axis by the amount of the semi-focal length to get a point P:

P = (b, (-2b + c’))

…then rotate P 22.5° counter-clockwise around the center and we’d have (F[sub]x[/sub], F[sub]y[/sub]), right? Yikes, it’s been a while since I’ve worked with matrices…

To answer your other questions, yes, distance preservation is quite important. Not that I wouldn’t want to explore other analytical options eventually, but the more I can determine about the original shape, the better off I’ll be. We’re kind of stumbling around in the dark (in case that’s not obvious), so the goal right now is to collect as much data about the shape as possible. Having the foci gives us the only other points besides the center that aren’t part of the hyperbola (disregarding the asymptotes). Yes, the parametric code I’ve been given uses the (sec,tan) parametric form I mentioned above, so finding a’ and b’ allows me to use it as is.

Continued thanks for all your help!

So, I’m going to give it a shot:

Given:
c’ = semifocal length
Center = (b, -2b)
theta = 0.392699 radians

To find:
Focus = F = (F[sub]x[/sub], F[sub]y[/sub]) where F[sub]y[/sub] > 0

Translate the center along the y-axis:
P = (Center[sub]x[/sub], Center[sub]y[/sub] + c’) = (b, -2b + c’)

P’ = P - Center = ((P[sub]x[/sub] - Center[sub]x[/sub]), (P[sub]y[/sub] - Center[sub]y[/sub])) = (0, c’)

then:
F[sub]x[/sub] = ( (P’[sub]x[/sub] * cos(theta)) - (P’[sub]y[/sub] * sin(theta)) ) + Center[sub]x[/sub]
F[sub]y[/sub] = ( (P’[sub]y[/sub] * cos(theta)) + (P’[sub]x[/sub] * sin(theta)) ) + Center[sub]y[/sub]

or:
F[sub]x[/sub] = (0 * cos(theta)) - (c’ * sin(theta)) + b
F[sub]y[/sub] = (c’ * cos(theta)) + (0 * sin(theta)) - 2b

Yes to both. (The convention on sin[sup]2[/sup] is somewhat confusing, since it looks a lot like sin[sup]-1[/sup], which is interpreted as the functional inverse (arcsin), not the reciprocal 1/sin. But it’s more convenient to write (otherwise we’d have to parenthesize (sin x)[sup]2[/sup] to distinguish it from sin(x[sup]2[/sup]), so that’s the convention.)

Well, not necessarily as “simple algebraic expressions.” An “algebraic” number is one which is the root of a polynomial equation with rational coefficients. Not all algebraic numbers can be expressed nicely as roots (as Galois proved). 22.5° is a pretty nice angle, though, so it turns out to be easy to find its cosine and sine.

Here’s a proof that the cosine of a rational angle is algebraic, which uses Euler’s formula: If t is a rational angle (i.e., its value in degrees is rational; equivalently, it’s a rational fraction of pi), then there is an integer n such that nt=m360° is some number of full rotations. So
1=exp(int)=(exp(it))[sup]n[/sup]=(cos t+isin t)[sup]n[/sup]
0=(cos t+i*sqrt(1-cos[sup]2[/sup]t))[sup]n[/sup]-1
If we expand the right-hand side as a binomial and take the real part, we will have a polynomial with integer coefficients which has cos t as a root. [This polynomial is, except for the 1, the Chebyshev polynomial T[sub]n[/sub].] So cos t (and similarly sin t) is algebraic.

Remember that you know the asymptotes (x=b and y=-(x+b)). The rotation angle is chosen to make the angle bisector of these asymptotes vertical. Because these asymptotes are at 0° and 45° from vertical, this requires a rotation by 45°/2=22.5°.

Yes. It’s mostly a matter of convention for ease of typesetting. Drawing a big square root over a long complicated expression is ugly; much easier to just put a superscript over the other side. (There’s also the question of principal roots, since the square root is double-valued.)

Yes, this should be right; and the details in your following post look right too.

One more comment, on something I missed the first time:

This is not an “if and only if” statement. Rational angles have algebraic sines and cosines, but not all angles with algebraic sines and cosines are rational.