As Tedjn mentioned you need to restrict cosine to a small enough interval due to the behavior near pi/2 (and kpi+pi/2 for all integers k). In fact it's a well-known trigonometric identity that [itex]\sin(h)/h \to 1[/itex] as [itex]h\to 0[/itex] so this gives us:
[tex]\left|\frac{\cos(\pi/2-h) -\cos(\pi/2)}{\pi/2-h-\pi/2}\right| = \frac{\cos(\pi/2-h)}{h} = \frac{\sin(h)}{h} \to 1[/tex]
for [itex]h \to 0[/itex]. This shows in particular:
[tex]d(\cos(\pi/2),\cos(x)) \to d(\pi/2,x) \qquad \mbox{for }x \to \pi/2[/tex]
so if you choose a contraction factor k < 1 it would result in a contradiction for x close enough to [itex]\pi/2[/itex].
However it's possible to show that cos is a contraction mapping defined on any set of the form [itex][-\pi/2+\epsilon,\pi/2-\epsilon][/itex] where [itex]0 < \epsilon < \pi/2[/itex]. In fact we know [itex]|sin h| < |h|[/itex] for all h in [itex][-\pi/2,\pi/2][/itex]. Let [itex]k=\sin(\pi/2-\epsilon) < 1[/itex]. Using the identity:
[tex]\cos y - \cos x = 2\sin\left(\frac{x+y}{2}\right)\sin\left(\frac{x-y}{2}\right)[/tex]
we have:
[tex]\begin{align*}<br />
f(x,y) = \left|\frac{\cos y - \cos x}{y - x}\right| &= \left|2\sin\left(\frac{x+y}{2}\right)\frac{\sin\left(\frac{x-y}{2}\right)}{x-y}\right| \\<br />
&= \left|\sin\left(\frac{x+y}{2}\right)\frac{\sin\left(\frac{x-y}{2}\right)}{\frac{x-y}{2}}\right|<br />
\end{align*}[/tex]
Clearly a least upper bound for f(x,y) is equivalent to a contraction factor. We can fix [itex]x=pi/2-\epsilon[/itex] and let y approach x from below. Then the first term of f(x,y) approaches [itex]\sin(\pi/2-\epsilon)[/itex] and the second approaches 1, so f(x,y) will approach [tex]k=sin(\pi/2-\epsilon)[/tex]. This shows that the contraction factor must at least be k. On the other hand we have:
[tex]\left|\frac{\sin\left(\frac{x-y}{2}\right)}{\frac{x-y}{2}}\right| \leq 1[/tex]
so
[tex]|f(x,y)| \leq \left|sin\left(\frac{x+y}{2}\right)\right| \leq \sin(\pi/2-\epsilon) = k[/tex]
which shows that k is actually the contraction factor for cos defined on [itex][-\pi/2+\epsilon,\pi/2-\epsilon][/itex].
This should however be sufficient as [itex]|cos(x)| \leq 1[/itex] so clearly any fixed point will lie in [itex][-1,1][/itex] and [itex]\pi/2 > 1[/itex].