Piotr, I think the question you really want to ask is:
Given a map $f:S^n \to S^2 \vee S^2$, how do I prove that it is homotopically nontrivial?
This is the so-called homotopy period problem, and it has several solutions. I'll outline one way.
Every simply connected compact manifold (or cellwise smooth complex) $X$ has a Sullivan minimal model $\mathcal M_X$, which is a free, minimal differential graded algebra:
- a differential graded algebra is a chain complex with a graded commutative multiplication satisfying the graded Leibniz rule (for example, the differential forms on a space)
- it is free as a graded-commutative algebra (so for example, the powers of a generator are zero iff the generator is in odd degree)
- it is minimal if indecomposable elements (linear combinations of generators) are never coboundaries.
The cohomology ring of $\mathcal M_X$ is the de Rham cohomology ring of $X$. Moreover there is an algebra homomorphism $m_X:\mathcal M_X \to \Omega^*X$ which induces an isomorphism on cohomology.
In the case of spheres and wedges of spheres, because the cohomology is concentrated in one dimension, this completely pins down $\mathcal M_X$—there are no choices involved in constructing it. So for example, for $S^n$, you have to start with one $n$-dimensional generator $x$ and $m_{S^n}(x)=\omega$ can be any form that integrates to 1 over $S^n$. Now if $n$ is odd, $x^2=0$ and we're done, $\mathcal M_{S^n}=\mathbb{R}\langle x \rangle$ and $m_{S^n}$ induces an isomorphism on cohomology. If $n$ is even, $x^2$ is nonzero, and so in order to induce an isomorphism on cohomology we have to kill it. That means there's also a $(2n-1)$-dimensional generator $y$ with $dy=x^2$. Now of course $m_{S^n}(x^2)=0$ so we can set $m_{S^n}(y)=0$ as well.
It turns out that the indecomposables in degree $k$ are naturally isomorphic to $\operatorname{Hom}(\pi_k(X),\mathbb{R})$. So if you're willing to assume this, we've proved that $\pi_{4n-1}(S^{2n})$ is nontrivial. Now the question is, how do you detect it, for a map $f:S^3 \to S^2$? Of course you already know the answer to this, but I want to give a slightly different answer.
This $f$ is homotopically trivial if and only if it extends to $D^4$. Now Sullivan tells us that asking if $f$ extends to $D^4$ is the same as asking if the map $f^*m_{S^2}:\mathcal M_{S^2} \to \Omega^*(S^3)$ lifts to $\Omega^*(D^4)$. One such lift would of course be $F^*m_{S^2}$, for a genuine filling $F:D^4 \to S^2$, but there could be many lifts that don't come from such a filling. For example, a lift which comes from a filling will always send the 3-dimensional generator $y$ to $0$, but a general lift need not do that.
How do you construct a lift $\phi$? Well, first you extend the form $f^*m_{S^2}(x)$ to a closed form $\phi(x)$ on $D^4$. There is no obstruction to doing this, by the Poincaré lemma. However, now $\phi(x)^2$ might not be zero, and we need a $\phi(y)$ such that $\phi(y)|_{S^3}=0$ and $d\phi(y)=\phi(x)^2$. You can build such a $\phi(y)$ if and only if $\int_{D^4} \phi(x)^2=0$. This $\int_{D^4} \phi(x)^2$ is the Hopf invariant. (This formula is related to the Whitehead formula via Stokes' theorem.)
Now $\mathcal M_{S^2 \vee S^2}$ is going to be much more complicated. You start by making sure that you have the right cohomology in degree 2, so you introduce two indecomposable generators $x_1$ and $x_2$. But now $\mathbb{R}\langle x_1,x_2 \rangle$ has cohomology in degree $4$ generated by $x_1^2, x_2^2, x_1x_2$, and you have to kill all of it by adding generators in degree $3$. Then that generates more cohomology in degree $5$ and you kill it by adding generators in degree $4$. And you just keep going, so it looks like this:
$$\begin{align*}x_1, x_2 &\mid dx_1=dx_2=0 \\
y_{11},y_{12},y_{22} &\mid dy_{ij}=x_ix_j \\
z_1, z_2 &\mid dz_1=x_1y_{12}-x_2y_{11},dz_2=x_2y_{12}-x_1y_{22} \\ \vdots &\mid \vdots\end{align*}$$
(I might have gotten the signs wrong in the last row.)
But if someone gives you a map $f:S^n \to S^2 \vee S^2$, the resulting map $f^*m_{S^2 \vee S^2} \to \Omega^*S^n$ is still very simple: it sends $x_1$ and $x_2$ to the pullbacks of the volume forms on the two spheres, and everything else to zero. Now if you want to know whether your map is (rationally) trivial, you check if it can be extended "formally" to $D^{n+1}$, that is, whether there is a map $\phi:\mathcal M_{S^2 \vee S^2} \to \Omega^*D^{n+1}$ whose restriction to $\Omega^*S^n$ is $f^*m_{S^2 \vee S^2}$. So in the case of $S^4$, it goes like this:
- You extend $f^*m_{S^2 \vee S^2}x_i$ to $\phi(x_i) \in \Omega^*D^5$. There's no obstruction.
- You find primitives for $\phi(x_1)^2$, $\phi(x_1)\phi(x_2)$, and $\phi(x_2)^2$. There's no obstruction to doing this, and those are going to be your $\phi(y_{ij})$'s.
- Now you have 5-forms $\phi(x_1y_{12}-x_2y_{11})$ and $\phi(x_2y_{12}-x_1y_{22})$ which are zero on the boundary $S^4$. The obstructions to finding primitives for these that are zero on the boundary are their integrals over $D^5$. Sullivan's theory says that these will be the same no matter how you chose the $\phi(y_{ij})$.
- Now there are infinitely many additional generators of $\mathcal M_{S^2 \vee S^2}$, but luckily all their differentials are in degrees $\geq 6$, and therefore automatically go to zero under a map to $\Omega^*D^5$. So if there's no obstruction corresponding to 4-dimensional generators, we can send the generators in higher degrees to zero and be done.
The 5-dimensional obstructions are the equivalent of the Hopf invariant in this situation. Using Stokes' theorem repeatedly, you can also come up with an obstruction that lives entirely in $S^4$, just using primitives without extensions. But that's a bit harder to describe.
If you want to understand the proofs of these statements, I recommend Griffiths and Morgan's book. Section 3 of my paper "Plato's cave and differential forms" also contains a summary.
Addendum: The only things I really used about smooth forms in the above arguments are (1) the fact that they form a graded commutative DGA and (2) the Poincaré lemma. So if you want to think about other types of cochains, you can do that as long as they satisfy those two properties. In my work I have sometimes used flat forms instead of smooth ones.