# Derivation of the Least Squares Estimator for Beta in Matrix Notation

The following post is going to derive the least squares estimator for $\beta$, which we will denote as $b$. In general start by mathematically formalizing relationships we think are present in the real world and write it down in a formula.

# Binomial Distribution

The binomial distribution is closely related to the Bernoulli distribution. In order to understand it better assume that $X_{1},X_{2},...,X_{n}$ are i.i.d (independent, identical distributed) variables following a Bernoulli distribution with $P(X_{i}=1)=\pi$ and $P(X_{i}=0)=1-\pi$.