1)
In general, given a function f(x), f'(a) is the slope of the tangent line to the graph of f(x) at x=a.
Thus, in our case, calculating the derivative of y(x),

Then, evaluate y'(x) at the x-coordinate of point P (x=pi/2), as shown below

Therefore, the slope of the tangent line to the curve at P is equal to -1.
Calculating the equation of such line given its slope and a point on it,

The answer to the first part is y=-x+(6+pi)/2, which is equivalent to y=-x+pi/2+3
(pi/2+3=4.570796...)
2)According to the question, the line is the horizontal tangent to the curve at Q; therefore, its slope is equal to zero because it is horizontal.
Then, we need to find the y-coordinate of point Q. Notice that the x-coordinate of point Q is 1; thus,

Therefore, the exact equation is y=5+cot(1)-2csc(1), or approximately y=3.2653...