Solution (source code)

= Solution

Use the double <covering map> $\pi:S^n\to\mathbb{RP}^n$ and its deck <involution>, the <antipodal map> $a(x)=-x$. The given sphere <cohomology> vanishes outside degrees $0,n$, so only those degrees can survive as invariant classes. The degree-zero action is the identity because the sphere is connected for $n\geq1$.

For the top degree, orient $S^n$ as the boundary of the unit ball. A positive tangent basis $(v_1,\ldots,v_n)$ at $x$ means that $(x,v_1,\ldots,v_n)$ has positive <determinant> in $\mathbb R^{n+1}$. Under the antipodal map every one of these $n+1$ vectors changes sign, so the <orientation> sign is $(-1)^{n+1}$. Equivalently, the sphere <volume form> is
$$
\omega_x(v_1,\ldots,v_n)=\det(x,v_1,\ldots,v_n),\qquad
\boxed{a^*\omega=(-1)^{n+1}\omega.}
$$
Its <cohomology> class is nonzero by the integral argument and therefore generates the one-dimensional top <de Rham cohomology>. Thus the top class is invariant precisely when $n$ is an <odd integer>. Applying the quotient result yields
$$
\boxed{H^p_{\mathrm{dR}}(\mathbb{RP}^n)\cong
\begin{cases}
\mathbb R,&p=0,\\
\mathbb R,&p=n\text{ and }n\text{ is odd},\\
0,&\text{otherwise},
\end{cases}\qquad n\geq1.}
$$
In particular $\mathbb{RP}^1$ has one copy of $\mathbb R$ in each of degrees zero and one. These are real <cohomology> groups; integral torsion is not detected by <de Rham cohomology>.