Solution (source code)

= Solution

The normalized linear <polarization state> is $|\theta\rangle=\cos\theta|H\rangle+\sin\theta|V\rangle$. A transmitted-photon count implements the <projector> $|\theta\rangle\langle\theta|$. The <Born rule> gives
$$
\boxed{p(\theta)=|\langle\theta|H\rangle|^2=\cos^2\theta,}
$$
the single-photon form of <Malus's law>, assuming ideal polarizers and detection.