Lagrange's four-square theorem states that every non-negative integer may be expressed as the sum of at most four squares. By the Euler four-square identity, it is enough to show that every prime is expressible by at most four squares. It was later proved that only the numbers of the form $4^n(8m +
7)$ require four squares.
This shows that $g(2) = G(2) = 4$ where $g$ and $G$ are the Waring functions.