Function Repository Resource:

FociPointHyperbola

Source Notebook

Find the equation for a hyperbola given two foci and a point

Contributed by: Ed Pegg Jr and Jan Mangaldan

ResourceFunction["FociPointHyperbola"][{f1,f2,p},{x,y}]

returns the hyperbola A x2+B x y+C y2+D x+E y+F in the variables x and y, given the foci f1,f2 and a point p through which the hyperbola passes.

ResourceFunction["FociPointHyperbola"][{f1,f2,p},t]

returns a parametric equation in the variable t.

Examples

Basic Examples (4) 

Find the Cartesian equation of a hyperbola with foci (2,2) and (3,5) that goes through point (1,3):

In[1]:=
{F, G, H} = {{2, 2}, {3, 5}, {1, 3}};
eq = ResourceFunction["FociPointHyperbola"][{F, G, H}, {x, y}]
Out[2]=

Show the hyperbola:

In[3]:=
ContourPlot[eq == 0, {x, 0, 7}, {y, 0, 7}, Epilog -> {Inset["F", F], Inset["G", G], Inset["H", H]}]
Out[3]=

Find the three hyperbolas generated by the three points:

In[4]:=
hyps = Table[
  ResourceFunction["FociPointHyperbola"][
   RotateRight[{F, G, H}, k], {x, y}], {k, 0, 2}]
Out[4]=

The three hyperbolas happen to intersect at the inner and outer Soddy centers for triangle ΔFGH:

In[5]:=
ContourPlot[{hyps[[1]] == 0, hyps[[2]] == 0, hyps[[3]] == 0}, {x, 0, 7}, {y, 0, 7}, Epilog -> {Inset["F", F], Inset["G", G], Inset["H", H]}]
Out[5]=

Scope (2) 

Generate the parametric equations of a hyperbola with foci (2,2) and (3,5) that goes through point (1,3):

In[6]:=
{F, G, H} = {{2, 2}, {3, 5}, {1, 3}};
hyp = ResourceFunction["FociPointHyperbola"][{F, G, H}, t]
Out[7]=

Show the hyperbola:

In[8]:=
ParametricPlot[hyp, {t, -\[Pi], \[Pi]}, Axes -> None, Epilog -> {Inset["F", F], Inset["G", G], Inset["H", H]}, Frame -> True]
Out[8]=

Properties and Relations (4) 

Use a different set of variables:

In[9]:=
ResourceFunction[
 "FociPointHyperbola"][{{0, 0}, {5, 7}, {2, 1}}, {a, b }]
Out[9]=

Use formal variables:

In[10]:=
ResourceFunction[
 "FociPointHyperbola"][{{0, 0}, {5, 7}, {2, 1}}, {\[FormalX], \[FormalY] }]
Out[10]=

If no variables are given, formal variables are used by default:

In[11]:=
ResourceFunction["FociPointHyperbola"][{{0, 0}, {5, 7}, {2, 1}}]
Out[11]=

Use FociPointHyperbola to generate the implicit Cartesian equation of a hyperbola:

In[12]:=
{F, G, H} = {{8, 0}, {0, 6}, {18/5, 33/10}};
ResourceFunction["FociPointHyperbola"][{F, G, H}, {x, y}]
Out[13]=

Use GroebnerBasis to get an equivalent result:

In[14]:=
First[GroebnerBasis[
  Sqrt[# . # &[{x, y} - F]] - Sqrt[# . # &[{x, y} - G]] == Sqrt[# . # &[H - F]] - Sqrt[# . # &[H - G]], {x, y}]]
Out[14]=

Generate an equivalent parametric equation:

In[15]:=
ResourceFunction["FociPointHyperbola"][{F, G, H}, t]
Out[15]=

Use GroebnerBasis to derive the implicit Cartesian equation from the parametric equation:

In[16]:=
First[GroebnerBasis[
  Append[Thread[{x, y} == %], Sec[t]^2 - Tan[t]^2 == 1], {x, y}, {Sec[t], Tan[t]}]]
Out[16]=

Use the resource function HyperbolaProperties to generate properties of the hyperbola:

In[17]:=
ResourceFunction["HyperbolaProperties"][
 ResourceFunction[
   "FociPointHyperbola"][{{0, 0}, {5, 7}, {2, 1}}, {x, y}] == 0, {x, y}]
Out[17]=

Get a hyperbola equation:

In[18]:=
hyp = ResourceFunction[
  "FociPointHyperbola"][{{0, 0}, {5, 7}, {2, 1}}, {x, y}]
Out[18]=

Show positions for coefficients in A x2+B x y+C y2+D x+E y+F=0:

In[19]:=
pos = CoefficientList[\[FormalCapitalA] x^2 + \[FormalCapitalB] x y + \[FormalCapitalC] y^2 + \[FormalCapitalD] x + \[FormalCapitalE] y + \[FormalCapitalF], {x, y}]
Out[19]=

Get the coefficients:

In[20]:=
coeff = CoefficientList[hyp, {x, y}]
Out[20]=

See the coefficients in the standard order:

In[21]:=
Transpose[
 Sort[Select[Transpose[Flatten /@ {pos, coeff}], Not[First[#] === 0] &]]]
Out[21]=

Neat Examples (5) 

Three arbitrary circles and some middle circles:

In[22]:=
circs = {Circle[{0, 0}, 1], Circle[{8, 0}, 3], Circle[{0, 6}, 2]};
Graphics[{circs, Green, Circle[{3, 0}, 2], Circle[{0, 5/2}, 3/2], Circle[{18/5, 33/10}, 5/2]}]
Out[23]=

Find the three hyperbolas using two circle centers and a midcircle center:

In[24]:=
ab = ResourceFunction[
   "FociPointHyperbola"][{{0, 0}, {8, 0}, {3, 0}}, {x, y}];
ac = ResourceFunction[
   "FociPointHyperbola"][{{0, 0}, {0, 6}, {0, 5/2}}, {x, y}];
bc = ResourceFunction[
   "FociPointHyperbola"][{{8, 0}, {0, 6}, {18/5, 33/10}}, {x, y}];

Find real-valued intersection points of the three hyperbolas:

In[25]:=
centers = Select[{x, y} /. Solve[ab == ac == bc], Im /@ # == {0, 0} &]
Out[25]=

Find a few distances:

In[26]:=
dist1 = RootReduce[EuclideanDistance[centers[[1]], circs[[1, 1]]] - 1];
dist2 = RootReduce[
   EuclideanDistance[centers[[2]], circs[[1, 1]]] + 1];

Show two circles tangent to the given circles:

In[27]:=
Graphics[{circs, Green, Circle[centers[[1]], dist1], Red, Circle[centers[[2]], dist2], Blue, Point[centers]}]
Out[27]=

Version History

  • 1.0.0 – 18 July 2022

Related Resources

License Information