d[x_]:=10000-1000(Sqrt[x])

p[x_]:=(x-20)d[x]

p'[x]

Expand[p'[x]]

Manipulate[
Column[{"Demand curve:",
Show[Plot[10000-1000Sqrt[z],{z,0,100}],
Graphics[{{Style[Text["d(x) = 10000-1000(Sqrt[x])",{60,9000} ],14],
Style[Text["Cost of production per unit = 20",{60,8000} ],14],
Text[If[x>20,"Profit",If[x<20,"Loss",""]],{(x+20)/2,(10000-1000Sqrt[x])/2}]},{If[x>20,RGBColor[0,0.5,0,0.3],If[x<20,RGBColor[0.4,0,0,0.1],RGBColor[0,0,0,0]]],Rectangle[{20,0},{x,10000-1000Sqrt[x]}]},{{PointSize[0.03],Point[{x,10000-1000Sqrt[x]}]}}}],ImageSize->400],
"","Profit curve:",
Show[Plot[(z-20)(10000-1000Sqrt[z]),{z,0,100}],
Graphics[{{Style[Text["p(x) = (x-20)d(x) = "<>ToString[(x-20)(10000-1000Sqrt[x])],{60,-130000}],16]},{PointSize[0.03],Point[{x,(x-20)(10000-1000Sqrt[x])}]}}],ImageSize->400],
"","Profit rate of change:",
Show[Plot[10000-((500 (-20+z))/(Sqrt[z]))-1000 (Sqrt[z]),{z,0,100}],
Graphics[{{PointSize[0.03],Point[{x,If[x<1,100000,10000-((500 (-20+x))/(Sqrt[x]))-1000 (Sqrt[x])]}]}}],ImageSize->400]
}
],
{{x,20},0,100}]

p'[x]

Solve[p'[x]==0]

N[%]

p[56.998]

d[56.998]