Plot[x^3-15 x+18,{x,-5,7}]

Table[{x,x^3-15 x+18},{x,-5,7}]//MatrixForm

curve=ContourPlot[
y^2==x^3-15x+18
,{x,-10,30},{y,-30,30}]

Show[curve,
Graphics[Point[{{0,Sqrt[18]},{0,-Sqrt[18]},{-1,-Sqrt[32]},{-1,Sqrt[32]},{1,2},{1,-2}}]]]

Plot[(x-1)^2(x+1),{x,-5,7}]

ContourPlot[
y^2==(x-1)^2(x+1)
,{x,-10,30},{y,-30,30}]

Show[curve,
p=Graphics[{PointSize[Large],Point[{x1=1,y1=2}],Text[Style["P",Large],{1,2}-{1.5,1.5}]}],
q=Graphics[{PointSize[Large],Point[{x2=7,y2=16}],Text[Style["Q",Large],{7,16}+{1.5,1.5}]}]
]

lambda=(y2-y1)/(x2-x1)

b=b/.Solve[
y==lambda  x + b
/. {x->x1,y->y1},
b][[1]]

Show[curve,
p,
q,
L=Plot[lambda  x+b,{x,-10,30},PlotStyle->Red]
]

Factor[9(x^3)-49(x^2)-121x+161]

x3=x3=lambda^2 - x1-x2;
y3=lambda  (x3 -x1)+y1

Show[curve,
p,
q,
L,
r=Graphics[{PointSize[Large],Point[{x3,y3}],Text[Style["R",Large],{x3,y3}-{1.5,1.5}]}]
]

Show[curve,
p,
q,
L,
r,
s=Graphics[{PointSize[Large],Point[{x3,-y3}],Text[Style["S",Large],{x3,-y3}+{1.5,1.5}]}]
]

f[x_]:=x^3+3x+2;
p=5;
pts={};
squares={};
For[x=0,x<p,x++,
AppendTo[pts,{x,Mod[f[x],p]}];
AppendTo[squares,{x,Mod[x^2,p]}];
]
pts
squares

4 3^3+27 2^2