ptsl[m_,p_,x_]:=m x+ p[[2]]-m p[[1]]

tpl[p_,q_,x_]:=(p[[2]]-q[[2]])/(p[[1]]-q[[1]])(x-p[[1]])+p[[2]]//Simplify

cu[x_]:=x^3-x;cud[x_]:=cu'[x]

Manipulate[
Show[
Plot[
{cu[x],
If[
a==b,
ptsl[cud[a],{a,cu[a]},x],
tpl[{a,cu[a]},{b,cu[b]},x]
]
},
{x,-1.5,1.5},PlotRange->{{-1.5,1.5},{-2.2,2.2}},PlotStyle->{Blue,Red},
AspectRatio->4.4/3
],
Graphics[
{Black,
PointSize[.02],
Point[{a,cu[a]}],
Point[{b,cu[b]}]
}
]
],
{{a,-1},-1.5,1.5,Appearance->"Labeled"},{{b,.5},-1.5,1.5,Appearance->"Labeled"},
SaveDefinitions->True
]