6
$\begingroup$

Given the coordinates p1, p2, and p3 of the three vertices of a triangle, find the standard equation for the circumscribed circle of the triangle

ClearAll["`*"]
p1 = {3, 5}
p2 = {6, 7}
p3 = {8, 9}
Cir = CircleThrough[{p1, p2, p3}]
(x - Cir[[1]][[1]])^2 + (y - Cir[[1]][[2]])^2 == (Cir[[-1]])^2

to kglr:

running you code I get the different result:

enter image description here

ClearAll["`*"]
p1 = {3, 5}
p2 = {6, 7}
p3 = {8, 9}
Cir = Insphere[{p1, p2, p3}]
Apply[Total[({x, y} - #)^2] == #2^2 &]@Cir
$\endgroup$

6 Answers 6

6
$\begingroup$

Update: We can process Cir to get the desired equation:

Apply[Total[({x, y} - #)^2] == #2^2 &] @ Cir

enter image description here

Original answer:

RegionMember[Cir][{x, y}] /. _Element -> True  

enter image description here

TeXForm @ %

$\left(x+\frac{9}{2}\right)^2+\left(y-\frac{39}{2}\right)^2=\frac{533}{2}$

$Version

"13.1.0 for Linux x86 (64-bit) (June 16, 2022)"

$\endgroup$
7
  • 1
    $\begingroup$ ClearAll["`*"] p1 = {3, 5} p2 = {6, 7} p3 = {8, 9} Cir = CircleThrough[{p1, p2, p3}] eq1 = SubtractSides[ Simplify[RegionMember[Cir][{x, y}], {x, y} \[Element] Reals]] Solve[ForAll[{x, y}, Apply[Subtract, eq1] == (x - a)^2 + (y - b)^2 - r^2], {a, b, r}, Assumptions -> r > 0] (x - a)^2 + (y - b)^2 == r^2 /. % $\endgroup$
    – csn899
    Commented Apr 24, 2023 at 10:33
  • $\begingroup$ The results displayed after running are not the ones you mentioned above $\endgroup$
    – csn899
    Commented Apr 24, 2023 at 11:02
  • $\begingroup$ @csn899, can you post what result you get? $\endgroup$
    – kglr
    Commented Apr 24, 2023 at 11:15
  • $\begingroup$ could be version/os difference. I am using v13.1.0 in Linux $\endgroup$
    – kglr
    Commented Apr 24, 2023 at 11:18
  • 1
    $\begingroup$ @csn899, (1) the expression Cir has the form Circle[center, radius]. The region function for a circle is (x- center[[1]])^2 + (y - center[[2]])^2 == radius^2 which can be written as Total[(({x,y}-center)^2] == radius^2. (2) Apply[FOO]@BAR[x,y]` replaces the head (BAR) of BAR[x,y] with FOO to give FOO[x,y]. $\endgroup$
    – kglr
    Commented Apr 25, 2023 at 21:15
5
$\begingroup$

You could use RegionConvert to do the work of finding the equation for you:

p1 = {3, 5}
p2 = {6, 7}
p3 = {8, 9}
Cir = CircleThrough[{p1, p2, p3}]
RegionConvert[Cir, "Implicit"]
(* ImplicitRegion[134+9x+x^2+y^2==39y,{x,y}] *) 
$\endgroup$
1
  • 1
    $\begingroup$ One can also use RegionMember[Cir, {x, y}] or such if RegionConvert is not available or fails (on current release it doesn't support non-constant regions). $\endgroup$
    – kirma
    Commented Apr 24, 2023 at 13:07
4
$\begingroup$

Looks ok to me. But you can make it little more clear

Mathematica graphics

ClearAll["Global`*"]
p1 = {3, 5}
p2 = {6, 7}
p3 = {8, 9}
pts = {p1, p2, p3};
pol = Polygon[pts];
cir = CircleThrough[pts]
x0 = cir[[1, 1]];
y0 = cir[[1, 2]];
r = cir[[2]];
c = (x - x0)^2 + (y - y0)^2 == r^2
g1 = Graphics[{pol, Red, Point[pts]}, ImageSize -> 200];
g2 = Graphics[{{Thick, Dashed, Blue, cir},
    {pol},
    {Red, Point[pts]},
    {Blue, PointSize[.03], Point[{x0, y0}]},
    {Text[c, {x0, y0}, {.4, 2}]}
    }, Axes -> True, ImageSize -> 300];
Grid[{{g1, g2}}, Frame -> All]
$\endgroup$
4
$\begingroup$
ClearAll["`*"]
p1 = {3, 5};
p2 = {6, 7};
p3 = {8, 9};
sol = Solve[
   r > 0 && (x - a)^2 + (y - b)^2 == r^2 /. 
      Thread[{x, y} -> #] & /@ {p1, p2, p3}, {a, b, r}];
eqn = (x - a)^2 + (y - b)^2 == r^2 /. sol[[1]]
eqn // Simplify

enter image description here

$\endgroup$
1
  • $\begingroup$ ClearAll["`*"] p1 = {3, 5} p2 = {6, 7} p3 = {8, 9} Cir = CircleThrough[{p1, p2, p3}] RegionConvert[Cir, "Implicit"] sol = Solve[ r > 0 && (x - a)^2 + (y - b)^2 == r^2 /. Thread[{x, y} -> #] & /@ {p1, p2, p3}, {a, b, r}] (x - a)^2 + (y - b)^2 == r^2 /. sol $\endgroup$
    – csn899
    Commented Apr 24, 2023 at 10:23
2
$\begingroup$

It very much depends on what you mean by "better". Here's a version that uses a template, which is useful if you want fine-grained control, especially for presentation. I demonstrate this with HoldForm, which suppresses evaluation so you can see all three squared sub-parts).

CircleEquation[pts : {{_, _} ..}] :=
  TemplateApply[
    TemplateExpression[HoldForm[(\[FormalX] - TemplateSlot[1])^2 + (\[FormalY] - TemplateSlot[2])^2 == TemplateSlot[3]^2]],
    FlattenAt[List @@ CircleThrough[pts], 1]];
CircleEquation[{p1, p2, p3}]

enter image description here

$\endgroup$
0
$\begingroup$
circle = (x - xc)^2 + (y - yc)^2 == r^2; 
problem = Append[
    (circle /. {x -> #1[[1]], 
        y -> #1[[2]]} & ) /@ {{3, 5}, {6, 7}, 
      {8, 9}}, r >= 0]; 
circle /. Solve[problem]
{(9/2 + x)^2 + (-(39/2) + y)^2 == 533/2}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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