# You need "the slope" at point (a,0) for the tangent, not the slope function at whole. So simply put x=a in your slope function, and everything looks fine. You can calculate the value of a, so try to do it. The value should be 0.75 pi.