Question
Let $\vec u (x,y,t) = (u(x,y,t),v(x,y,t),0)$ and suppose that $\vec u$ satisfies $\nabla \cdot \vec u=0$ (i.e. so $u_x+v_y=0$). Also, define the function $$\psi(x,y,t)=\psi _0(t)+\int _{(0,0)}^{(x,y)}(udy-vdx)$$ where $\psi _0 (t)$ is an arbitrary (suitably differentiable?) function.
Can anyone explain to me why $\psi$ satisfies $$u=\frac{\partial \psi}{\partial y} \qquad \text{and} \qquad v=-\frac{\partial \psi}{\partial x} \, \text ?$$
By Green's theorem and the condition $\nabla \cdot \mathbb{u} = 0$, for any smooth, simple closed contour $C$ forming the boundary of a region $D$ we have
$$\oint_C u \, dy - v \, dx = \int_D \left(\frac{\partial u}{\partial x} - \frac{\partial (-v)}{\partial x}\right) \, dA = \int_D \left(\frac{\partial u}{\partial x} + \frac{\partial v}{\partial x}\right) \, dA = 0.$$
Hence, the line integral defining the streamfunction is independent of path. Let a path from $(0,0)$ to $(x,y)$ be defined parametrically by $(g(\xi),h(\xi))$ for $0 \leqslant \xi \leqslant s$ where $g$ and $h$ are differentiable functions with $g(s) = x$ and $h(s) = y$.
We then have
$$\psi(g(s),h(s),t) = \psi_0(t) + \int_0^s (u h'(\xi) - vg'(\xi)) d\xi.$$
Differentiating both sides with respect to $s$, while applying the chain rule on the left and the fundamental theorem of calculus on the right, we obtain
$$\frac{\partial \psi}{\partial x} g'(s) + \frac{\partial \psi}{\partial y} h'(s) = uh'(s) - v g'(s).$$
Since this holds for every choice for $g$ and $h$, it follows that
$$u = \frac{\partial \psi}{\partial y}, \,\,\,\,\, v = -\frac{\partial \psi}{\partial x} $$