Reference: Transistors
Consider an ideal MOSFET, with threshhold voltage \(\tau\), gate voltage \(g\), and terminal voltages \(v_1\) and \(v_2\). Then the current out of terminal 1 is proportional to the following.
\[\max(0,g-v_1-\tau)^2 - \max(0,g-v_2-\tau)^2\]
Source
For a source, see this book. But the book expresses it in a more complicated form.
The book implicitly assumes \(g-v_1-\tau\) is nonnegative. Equation 3.5.4 describes what happens when \(g-v_2-\tau\) is also nonnegative, while Equation 3.5.8 describes what happens when it isn't. For the cases where \(g-v_1-\tau\) is negative, we can still deduce the behavior; if \(g-v_2-\tau\) is also negative, the transistor is simply deactivated; if not, then we use the fact that the transistor is symmetric. With some algebra, we confirm that the book's equations match mine in all four cases.