The Rubin Observatory active optics system (AOS) uses the wavefront estimation pipeline (WEP) to estimate the wavefront of the telescope from out-of-focus images of stars. This note describes the theory behind and derives the equations used by the WEP.