Where does this clever choice of differential come from? (calculating $\mathrm{H}^1_{\mathrm{dR}}(E/k))$ In these notes of Kedlaya, he calculates the de Rham cohomology of an affine part $X$ of an elliptic curve $E$ over a field $K$, given by $y^2 = P(x) = x^3 + ax + b$.
He uses these relations:

*

*$0 = y^2 - P(x)$

*$0 = d(y^2 - Pdx) = 2ydy - P'dx$

*$1 = AP + BP'$, for some $A,B$, using $(P,P')=1$
and the crux of the proof is when he produces a differential $\omega$ and expressions of $dx, dy$ in terms of $\omega$:
$$\omega = Aydx + 2Bdy$$
$$dx = y\omega,\;\;dy=\frac{1}{2}P'\omega$$
So that every element of $\Omega_{X/K}$ has a unique expression $(C + Dy)\omega$.
Verifying the relations of $dx, dy$ nicely uses each available relation once, but it didn't help me understand what is really going on.
Question: Where does this $\omega$ come from, and the expressions relating it to $dx,dy$?
I'm looking for either algebraic insights or (preferably) higher concept motivations, and I'm awaiting answers of the form, "Oh yes, $\omega$ is just [common thing that you should have thought of]."
I figure that $\omega$ is probably an invariant differential, but I'm not sure how to verify that or to produce those expressions relating $\omega, dx, dy$.
 A: Yes, $\omega$ is an invariant differential, also characterized by being nowhere vanishing (including the point at infinity).
At every point, $dx$ and $dy$ together span the cotangent space (which is $1$-dimensional). From the second equation, you see that $dx$ vanishes precisely when $y$ vanishes, and $dy$ vanishes precisely when $P'$ vanishes. This also gives you the vanishing orders. (Smoothness corresponds to the fact that this never happens simultaneously: $P'$ and $P$ are coprime due to your third equation, and thus also are $P'$ and $y$ (since $y^2=P$)).
Thus, both $dx/y$ and $dy/P'$ are differentials which are everywhere nonzero (including the point at infinity, which you can check by looking at the analogue of the second equation in another chart of $\mathbb{P}^2$). Since we are in genus $1$, there is a unique nowhere vanishing differential up to scalar multiples. The rest is convention: You pick one, $\omega = dx/y$, observe that your second equation tells you the scalar factor for the other one, $dy/P' = \frac{1}{2}\omega$, and you use the fact that $y$ and $P'$ are coprime to clear the denominators:
$$
\omega = (Ay^2 + BP') \omega = Ay dx + 2B dy
$$
