How the classical linear correlation of spin is derived? 
I found this image on Wikipedia under Bell's theorem. I understand the blue curve generated by quantum mechanics, but couldn't understand how the classical curve (red curve) is generated (I don't understand how correlation changes with angle, classically). This has been asked here before but I didn't find any relevant answer. Please help me.
 A: The classical correlation is obtained by averaging the measurement results depending on the direction of measurement and the incoming photon polarization (physically, but the lambda could be any data, provided all of them are averaged)  :
$$C(a,b)=-\int A(a,\lambda)A(b,\lambda)d\lambda$$
The case of linear correlation is when the result is 1 when the projection of the incoming photon polarization is positive on the direction of measurement :
$$A(a,\lambda)=sign(\cos(a-\lambda))$$
The correlation is simply obtained by graphically drawing the above integral.
But classical correlation could be other, for example
Suppose we take a nonrelative separable function for :
$$A(a,\lambda)=sign(\cos a\cos\lambda)$$
Then it is easy to see that
$$C(a,b)=-sign(\cos a\cos b)$$
This is very sensitive at $\frac{\pi}{2}$ because of the sign function and any small variation could make the CHSH jump.
Suppose then wlog setting the zero of both angles with : $-a$ then we obtain a step function for the relative angle :
$$C(0,b-a)=\left\{\begin{array}{c} -1, 0\leq b-a\leq \frac{\pi}{2}\\+1, \frac{\pi}{2}\leq b-a\leq \pi\end{array}\right.$$
