# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (68 sloc) 3.86 KB
 Equation of a hyperbola
randRange(2, 9) randRange(2, 9) A * A B * B randRange( -9, 9 ) randRange( -9, 9 ) rand(2) "+" WHICH_NEG === 1 ? "" : "-" H === 0 ? "x^2" : expr(["^", ["+", "x", -H], 2]) K === 0 ? "y^2" : expr(["^", ["+", "y", -K], 2]) H === 0 ? "\\dfrac{x^2}{" + A2 + "}" : "\\dfrac {" + expr(["^", ["+", "x", -H], 2]) + "}{" + A2 +"}" K === 0 ? "\\dfrac{y^2}{" + B2 + "}" : "\\dfrac {" + expr(["^", ["+", "y", -K], 2]) + "}{" + B2 +"}"

The equation of hyperbola H is WHICH_NEG === 1 ? expr(["-", Y2T, X2T]) : expr(["-", X2T, Y2T]) = 1.

What are the asymptotes?

y = \pm B/A (x + -H) + K

We want to rewrite the equation in terms of y, so start off by moving the y terms to one side:

Y2T = Y_MINUS 1 X_MINUS X2T

Multiply both sides of the equation by B2.

Y = {Y_MINUS B2 X_MINUS \dfrac{X \cdot B2}{A2}}

Take the square root of both sides.

\sqrt{Y} = \sqrt{Y_MINUS B2 X_MINUS \dfrac{X \cdot B2}{A2}}

plus("y", -K) = \pm \sqrt{Y_MINUS B2 X_MINUS \dfrac{X \cdot B2}{A2}}

As x approaches positive or negative infinity, the constant term in the square root matters less and less, so we can just ignore it.

plus("y", -K) \approx \pm \sqrt{\dfrac{X \cdot B2}{A2}}

plus("y", -K) \approx \pm \left(\dfrac{B \cdot (plus("x", -H))}{A}\right)

Add K to both sides and rewrite Subtract -K from both sides and rewrite Rewrite as an equality in terms of y to get the equation of the asymptotes:

y = \pm fractionReduce(B, A)(plus( "x", -H ))K >= 0 ? "+" : "" K