# Plotting roots found using Reduce

I want to create a 2D scatter plot using roots found by the Reduce function; i.e., all integer points on a circle.

Reduce[x^2 + y^2 == 5^2, {x, y}, Integers]

How do I achieve this?

• In this very special case, try ListPlot[Reduce[x^2 + y^2 == 5^2, {x, y}, Integers] /. {And | Or -> List, _ == a_ :> a}]. But this is fragile and only works because the output is structured so nicely. Commented Nov 15, 2022 at 6:13
• ListPlot[SolveValues[x^2 + y^2 == 5^2, {x, y}, Integers], AspectRatio -> 1] Commented Nov 15, 2022 at 16:32

sol = Reduce[x^2 + y^2 == 5^2, {x, y}, Integers];
reg = ImplicitRegion[sol, {x, y}];
Region[reg, BaseStyle -> {PointSize[Large], Red}]


• +1. I like it because this is a natural way. Commented Nov 15, 2022 at 6:29
pts = {x, y} /. {ToRules[Reduce[x^2 + y^2 == 5^2, {x, y}, Integers]]}
circ = CircleThrough[RandomChoice[pts, 3]]

ListPlot[pts
, PlotStyle -> Directive[Black
, AbsolutePointSize[6]]
, AspectRatio -> Automatic
, Epilog -> {
Dashed, Red, circ
}
]


A labeled variant:

ListPlot[Callout[#, #] & /@ pts
, PlotStyle -> Directive[Black
, AbsolutePointSize[6]]
, AspectRatio -> Automatic
, Frame -> True
, Epilog -> {
Dashed, Red, circ
}
]


Inelegant, but revealing:

jj = Reduce[x^2 + y^2 == 25, {x, y}, Integers];

kk = Table[{jj[[i, 1, 2]], jj[[i, 2, 2]]}, {i, Length[jj]}];

Graphics[{Red, PointSize[0.02], Point /@ kk}, GridLines -> {Range[-5, 5], Range[-5, 5]}]


I am sure there are 10 ways to do this. One another way could be

sol = Reduce[x^2 + y^2 == 5^2, {x, y}, Integers];
List @@ Map[{First[#][[2]], Last[#][[2]]} &, sol];
Graphics[{
{Opacity[.1], Blue, Disk[]},
{Red, PointSize[0.02], Point[points]},
{Text[ToString[#], #, {-1.5, 0}] & /@ points}
},
Axes -> True]


If you do not want the disk, you can remove it.