Gauss–Markov theorem
In statistics, the Gauss–Markov theorem (or simply Gauss theorem for some authors) states that the ordinary least squares (OLS) estimator has the lowest sampling variance within the class of linear unbiased estimators, if the errors in the linear regression model are uncorrelated, have equal variances and expectation value of zero. The errors do not need to be normal, nor do they need to be independent and identically distributed (only uncorrelated with mean zero and homoscedastic with finite variance). The requirement that the estimator be unbiased cannot be dropped, since biased estimators exist with lower variance. See, for example, the James–Stein estimator (which also drops linearity), ridge regression, or simply any degenerate estimator.
The theorem was named after Carl Friedrich Gauss and Andrey Markov, although Gauss' work significantly predates Markov's. But while Gauss derived the result under the assumption of independence and normality, Markov reduced the assumptions to the form stated above. A further generalization to non-spherical errors was given by Alexander Aitken.

Statement
Suppose we have, in matrix notation, the linear relationship

  
    
      
        y
        =
        X
        β
        +
        ε
        ,
        
        (
        y
        ,
        ε
        ∈
        
          
            R
          
          
            n
          
        
        ,
        β
        ∈
        
          
            R
          
          
            K
          
        
        
           and 
        
        X
        ∈
        
          
            R
          
          
            n
            ×
            K
          
        
        )
      
    
    {\displaystyle y=X\beta +\varepsilon ,\quad (y,\varepsilon \in \mathbb {R} ^{n},\beta \in \mathbb {R} ^{K}{\text{ and }}X\in \mathbb {R} ^{n\times K})}
  expanding to,

  
    
      
        
          y
          
            i
          
        
        =
        
          ∑
          
            j
            =
            1
          
          
            K
          
        
        
          β
          
            j
          
        
        
          X
          
            i
            j
          
        
        +
        
          ε
          
            i
          
        
        
        ∀
        i
        =
        1
        ,
        2
        ,
        …
        ,
        n
      
    
    {\displaystyle y_{i}=\sum _{j=1}^{K}\beta _{j}X_{ij}+\varepsilon _{i}\quad \forall i=1,2,\ldots ,n}
  where 
  
    
      
        
          β
          
            j
          
        
      
    
    {\displaystyle \beta _{j}}
   are non-random but unobservable parameters, 
  
    
      
        
          X
          
            i
            j
          
        
      
    
    {\displaystyle X_{ij}}
   are non-random and observable (called the "explanatory variables"), 
  
    
      
        
          ε
          
            i
          
        
      
    
    {\displaystyle \varepsilon _{i}}
   are random, and so 
  
    
      
        
          y
          
            i
          
        
      
    
    {\displaystyle y_{i}}
   are random. The random variables 
  
    
      
        
          ε
          
            i
          
        
      
    
    {\displaystyle \varepsilon _{i}}
   are called the "disturbance", "noise" or simply "error" (will be contrasted with "residual" later in the article; see errors and residuals in statistics). Note that to include a constant in the model above, one can choose to introduce the constant as a variable 
  
    
      
        
          β
          
            K
            +
            1
          
        
      
    
    {\displaystyle \beta _{K+1}}
    with a newly introduced last column of X being unity i.e., 
  
    
      
        
          X
          
            i
            (
            K
            +
            1
            )
          
        
        =
        1
      
    
    {\displaystyle X_{i(K+1)}=1}
   for all 
  
    
      
        i
      
    
    {\displaystyle i}
  . Note that though 
  
    
      
        
          y
          
            i
          
        
        ,
      
    
    {\displaystyle y_{i},}
   as sample responses, are observable, the following statements and arguments including assumptions, proofs and the others assume under the only condition of knowing 
  
    
      
        
          X
          
            i
            j
          
        
        ,
      
    
    {\displaystyle X_{ij},}
   but not  
  
    
      
        
          y
          
            i
          
        
        .
      
    
    {\displaystyle y_{i}.}
  
The Gauss–Markov assumptions concern the set of error random variables, 
  
    
      
        
          ε
          
            i
          
        
      
    
    {\displaystyle \varepsilon _{i}}
  :

They have mean zero: 
  
    
      
        E
        ⁡
        [
        
          ε
          
            i
          
        
        ]
        =
        0.
      
    
    {\displaystyle \operatorname {E} [\varepsilon _{i}]=0.}
  
They are homoscedastic, that is all have the same finite variance: 
  
    
      
        Var
        ⁡
        (
        
          ε
          
            i
          
        
        )
        =
        
          σ
          
            2
          
        
        <
        ∞
      
    
    {\displaystyle \operatorname {Var} (\varepsilon _{i})=\sigma ^{2}<\infty }
   for all 
  
    
      
        i
      
    
    {\displaystyle i}
   and
Distinct error terms are uncorrelated: 
  
    
      
        
          Cov
        
        (
        
          ε
          
            i
          
        
        ,
        
          ε
          
            j
          
        
        )
        =
        0
        ,
        ∀
        i
        ≠
        j
        .
      
    
    {\displaystyle {\text{Cov}}(\varepsilon _{i},\varepsilon _{j})=0,\forall i\neq j.}
  A linear estimator of 
  
    
      
        
          β
          
            j
          
        
      
    
    {\displaystyle \beta _{j}}
   is a linear combination

  
    
      
        
          
            
              
                β
                ^
              
            
          
          
            j
          
        
        =
        
          c
          
            1
            j
          
        
        
          y
          
            1
          
        
        +
        ⋯
        +
        
          c
          
            n
            j
          
        
        
          y
          
            n
          
        
      
    
    {\displaystyle {\widehat {\beta }}_{j}=c_{1j}y_{1}+\cdots +c_{nj}y_{n}}
  in which the coefficients 
  
    
      
        
          c
          
            i
            j
          
        
      
    
    {\displaystyle c_{ij}}
    are not allowed to depend on the underlying coefficients 
  
    
      
        
          β
          
            j
          
        
      
    
    {\displaystyle \beta _{j}}
  , since those are not observable, but are allowed to depend on the values 
  
    
      
        
          X
          
            i
            j
          
        
      
    
    {\displaystyle X_{ij}}
  , since these data are observable.  (The dependence of the coefficients on each 
  
    
      
        
          X
          
            i
            j
          
        
      
    
    {\displaystyle X_{ij}}
   is typically nonlinear; the estimator is linear in each 
  
    
      
        
          y
          
            i
          
        
      
    
    {\displaystyle y_{i}}
   and hence in each random 
  
    
      
        ε
        ,
      
    
    {\displaystyle \varepsilon ,}
   which is why this is "linear" regression.)  The estimator is said to be unbiased if and only if

  
    
      
        E
        ⁡
        
          [
          
            
              
                
                  β
                  ^
                
              
            
            
              j
            
          
          ]
        
        =
        
          β
          
            j
          
        
      
    
    {\displaystyle \operatorname {E} \left[{\widehat {\beta }}_{j}\right]=\beta _{j}}
  regardless of the values of 
  
    
      
        
          X
          
            i
            j
          
        
      
    
    {\displaystyle X_{ij}}
  . Now, let 
  
    
      
        
          ∑
          
            j
            =
            1
          
          
            K
          
        
        
          λ
          
            j
          
        
        
          β
          
            j
          
        
      
    
    {\textstyle \sum _{j=1}^{K}\lambda _{j}\beta _{j}}
   be some linear combination of the coefficients. Then the mean squared error of the corresponding estimation is

  
    
      
        E
        ⁡
        
          [
          
            
              (
              
                
                  ∑
                  
                    j
                    =
                    1
                  
                  
                    K
                  
                
                
                  λ
                  
                    j
                  
                
                
                  (
                  
                    
                      
                        
                          
                            β
                            ^
                          
                        
                      
                      
                        j
                      
                    
                    −
                    
                      β
                      
                        j
                      
                    
                  
                  )
                
              
              )
            
            
              2
            
          
          ]
        
        ,
      
    
    {\displaystyle \operatorname {E} \left[\left(\sum _{j=1}^{K}\lambda _{j}\left({\widehat {\beta }}_{j}-\beta _{j}\right)\right)^{2}\right],}
  in other words, it is the expectation of the square of the weighted sum (across parameters) of the differences between the estimators and the corresponding parameters to be estimated. (Since we are considering the case in which all the parameter estimates are unbiased, this mean squared error is the same as the variance of the linear combination.) The best linear unbiased estimator (BLUE) of the vector 
  
    
      
        β
      
    
    {\displaystyle \beta }
   of parameters 
  
    
      
        
          β
          
            j
          
        
      
    
    {\displaystyle \beta _{j}}
   is one with the smallest mean squared error for every vector 
  
    
      
        λ
      
    
    {\displaystyle \lambda }
   of linear combination parameters.  This is equivalent to the condition that

  
    
      
        Var
        ⁡
        
          (
          
            
              
                β
                ~
              
            
          
          )
        
        −
        Var
        ⁡
        
          (
          
            
              
                β
                ^
              
            
          
          )
        
      
    
    {\displaystyle \operatorname {Var} \left({\widetilde {\beta }}\right)-\operatorname {Var} \left({\widehat {\beta }}\right)}
  is a positive semi-definite matrix for every other linear unbiased estimator 
  
    
      
        
          
            
              β
              ~
            
          
        
      
    
    {\displaystyle {\widetilde {\beta }}}
  .
The ordinary least squares estimator (OLS) is the function

  
    
      
        
          
            
              β
              ^
            
          
        
        =
        (
        
          X
          ′
        
        X
        
          )
          
            −
            1
          
        
        
          X
          ′
        
        y
      
    
    {\displaystyle {\widehat {\beta }}=(X'X)^{-1}X'y}
  of 
  
    
      
        y
      
    
    {\displaystyle y}
   and 
  
    
      
        X
      
    
    {\displaystyle X}
   (where 
  
    
      
        
          X
          ′
        
      
    
    {\displaystyle X'}
   denotes the transpose of 
  
    
      
        X
      
    
    {\displaystyle X}
  ) that minimizes the sum of squares of residuals (misprediction amounts):

  
    
      
        
          ∑
          
            i
            =
            1
          
          
            n
          
        
        
          
            (
            
              
                y
                
                  i
                
              
              −
              
                
                  
                    
                      y
                      ^
                    
                  
                
                
                  i
                
              
            
            )
          
          
            2
          
        
        =
        
          ∑
          
            i
            =
            1
          
          
            n
          
        
        
          
            (
            
              
                y
                
                  i
                
              
              −
              
                ∑
                
                  j
                  =
                  1
                
                
                  K
                
              
              
                
                  
                    
                      β
                      ^
                    
                  
                
                
                  j
                
              
              
                X
                
                  i
                  j
                
              
            
            )
          
          
            2
          
        
        .
      
    
    {\displaystyle \sum _{i=1}^{n}\left(y_{i}-{\widehat {y}}_{i}\right)^{2}=\sum _{i=1}^{n}\left(y_{i}-\sum _{j=1}^{K}{\widehat {\beta }}_{j}X_{ij}\right)^{2}.}
  The theorem now states that the OLS estimator is a BLUE. The main idea of the proof is that the least-squares estimator is uncorrelated with every linear unbiased estimator of zero, i.e., with every linear combination 
  
    
      
        
          a
          
            1
          
        
        
          y
          
            1
          
        
        +
        ⋯
        +
        
          a
          
            n
          
        
        
          y
          
            n
          
        
      
    
    {\displaystyle a_{1}y_{1}+\cdots +a_{n}y_{n}}
   whose coefficients do not depend upon the unobservable 
  
    
      
        β
      
    
    {\displaystyle \beta }
   but whose expected value is always zero.

Remark
Proof that the OLS indeed minimizes the sum of squares of residuals may proceed as follows with a calculation of the Hessian matrix and showing that it is positive definite. 
The MSE function we want to minimize is 

for a multiple regression model with p variables. The first derivative is 

where X is the design matrix 

The Hessian matrix of second derivatives is 

Assuming the columns of 
  
    
      
        X
      
    
    {\displaystyle X}
   are linearly independent so that 
  
    
      
        
          X
          
            T
          
        
        X
      
    
    {\displaystyle X^{T}X}
   is invertible, let 
  
    
      
        X
        =
        
          
            [
            
              
                
                  
                    
                      v
                      
                        1
                      
                    
                  
                
                
                  
                    
                      v
                      
                        2
                      
                    
                  
                
                
                  ⋯
                
                
                  
                    
                      v
                    
                    
                      p
                      +
                      1
                    
                  
                
              
            
            ]
          
        
      
    
    {\displaystyle X={\begin{bmatrix}\mathbf {v_{1}} &\mathbf {v_{2}} &\cdots &\mathbf {v} _{p+1}\end{bmatrix}}}
  , then 

Now let 
  
    
      
        
          k
        
        =
        (
        
          k
          
            1
          
        
        ,
        …
        ,
        
          k
          
            p
            +
            1
          
        
        
          )
          
            T
          
        
        ∈
        
          
            R
          
          
            (
            p
            +
            1
            )
            ×
            1
          
        
      
    
    {\displaystyle \mathbf {k} =(k_{1},\dots ,k_{p+1})^{T}\in \mathbb {R} ^{(p+1)\times 1}}
   be an eigenvector of 
  
    
      
        
          
            H
          
        
      
    
    {\displaystyle {\mathcal {H}}}
  . 

In terms of vector multiplication, this means 

where 
  
    
      
        λ
      
    
    {\displaystyle \lambda }
   is the eigenvalue corresponding to 
  
    
      
        
          k
        
      
    
    {\displaystyle \mathbf {k} }
  . Moreover, 

Finally, as eigenvector 
  
    
      
        
          k
        
      
    
    {\displaystyle \mathbf {k} }
   was arbitrary, it means all eigenvalues of 
  
    
      
        
          
            H
          
        
      
    
    {\displaystyle {\mathcal {H}}}
   are positive, therefore 
  
    
      
        
          
            H
          
        
      
    
    {\displaystyle {\mathcal {H}}}
   is positive definite. Thus, 

is indeed a global minimum.
Or, just see that for all vectors 
  
    
      
        
          v
        
        ,
        
          
            v
          
          
            T
          
        
        
          X
          
            T
          
        
        X
        
          v
        
        =
        ‖
        
          X
        
        
          v
        
        
          ‖
          
            2
          
        
        ≥
        0
      
    
    {\displaystyle \mathbf {v} ,\mathbf {v} ^{T}X^{T}X\mathbf {v} =\|\mathbf {X} \mathbf {v} \|^{2}\geq 0}
  . So the Hessian is positive definite if full rank.

Proof
Let 
  
    
      
        
          
            
              β
              ~
            
          
        
        =
        C
        y
      
    
    {\displaystyle {\tilde {\beta }}=Cy}
   be another linear estimator of 
  
    
      
        β
      
    
    {\displaystyle \beta }
   with 
  
    
      
        C
        =
        (
        
          X
          ′
        
        X
        
          )
          
            −
            1
          
        
        
          X
          ′
        
        +
        D
      
    
    {\displaystyle C=(X'X)^{-1}X'+D}
   where 
  
    
      
        D
      
    
    {\displaystyle D}
   is a 
  
    
      
        K
        ×
        n
      
    
    {\displaystyle K\times n}
   non-zero matrix. As we're restricting to unbiased estimators, minimum mean squared error implies minimum variance. The goal is therefore to show that such an estimator has a variance no smaller than that of 
  
    
      
        
          
            
              β
              ^
            
          
        
        ,
      
    
    {\displaystyle {\widehat {\beta }},}
   the OLS estimator. We calculate:

  
    
      
        
          
            
              
                E
                ⁡
                
                  [
                  
                    
                      
                        β
                        ~
                      
                    
                  
                  ]
                
              
              
                
                =
                E
                ⁡
                [
                C
                y
                ]
              
            
            
              
              
                
                =
                E
                ⁡
                
                  [
                  
                    
                      (
                      
                        (
                        
                          X
                          ′
                        
                        X
                        
                          )
                          
                            −
                            1
                          
                        
                        
                          X
                          ′
                        
                        +
                        D
                      
                      )
                    
                    (
                    X
                    β
                    +
                    ε
                    )
                  
                  ]
                
              
            
            
              
              
                
                =
                
                  (
                  
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    +
                    D
                  
                  )
                
                X
                β
                +
                
                  (
                  
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    +
                    D
                  
                  )
                
                E
                ⁡
                [
                ε
                ]
              
            
            
              
              
                
                =
                
                  (
                  
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    +
                    D
                  
                  )
                
                X
                β
              
              
              
                E
                ⁡
                [
                ε
                ]
                =
                0
              
            
            
              
              
                
                =
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                
                  X
                  ′
                
                X
                β
                +
                D
                X
                β
              
            
            
              
              
                
                =
                (
                
                  I
                  
                    K
                  
                
                +
                D
                X
                )
                β
                .
              
            
          
        
      
    
    {\displaystyle {\begin{aligned}\operatorname {E} \left[{\tilde {\beta }}\right]&=\operatorname {E} [Cy]\\&=\operatorname {E} \left[\left((X'X)^{-1}X'+D\right)(X\beta +\varepsilon )\right]\\&=\left((X'X)^{-1}X'+D\right)X\beta +\left((X'X)^{-1}X'+D\right)\operatorname {E} [\varepsilon ]\\&=\left((X'X)^{-1}X'+D\right)X\beta &&\operatorname {E} [\varepsilon ]=0\\&=(X'X)^{-1}X'X\beta +DX\beta \\&=(I_{K}+DX)\beta .\\\end{aligned}}}
  Therefore, since 
  
    
      
        β
      
    
    {\displaystyle \beta }
   is unobservable, 
  
    
      
        
          
            
              β
              ~
            
          
        
      
    
    {\displaystyle {\tilde {\beta }}}
   is unbiased if and only if 
  
    
      
        D
        X
        =
        0
      
    
    {\displaystyle DX=0}
  . Then:

  
    
      
        
          
            
              
                Var
                ⁡
                
                  (
                  
                    
                      
                        β
                        ~
                      
                    
                  
                  )
                
              
              
                
                =
                Var
                ⁡
                (
                C
                y
                )
              
            
            
              
              
                
                =
                C
                
                   Var
                
                (
                y
                )
                
                  C
                  ′
                
              
            
            
              
              
                
                =
                
                  σ
                  
                    2
                  
                
                C
                
                  C
                  ′
                
              
            
            
              
              
                
                =
                
                  σ
                  
                    2
                  
                
                
                  (
                  
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    +
                    D
                  
                  )
                
                
                  (
                  
                    X
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    +
                    
                      D
                      ′
                    
                  
                  )
                
              
            
            
              
              
                
                =
                
                  σ
                  
                    2
                  
                
                
                  (
                  
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    X
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    +
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    
                      D
                      ′
                    
                    +
                    D
                    X
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    +
                    D
                    
                      D
                      ′
                    
                  
                  )
                
              
            
            
              
              
                
                =
                
                  σ
                  
                    2
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                +
                
                  σ
                  
                    2
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                (
                D
                X
                
                  )
                  ′
                
                +
                
                  σ
                  
                    2
                  
                
                D
                X
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                +
                
                  σ
                  
                    2
                  
                
                D
                
                  D
                  ′
                
              
            
            
              
              
                
                =
                
                  σ
                  
                    2
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                +
                
                  σ
                  
                    2
                  
                
                D
                
                  D
                  ′
                
              
              
              
                D
                X
                =
                0
              
            
            
              
              
                
                =
                Var
                ⁡
                
                  (
                  
                    
                      
                        β
                        ^
                      
                    
                  
                  )
                
                +
                
                  σ
                  
                    2
                  
                
                D
                
                  D
                  ′
                
              
              
              
                
                  σ
                  
                    2
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                =
                Var
                ⁡
                
                  (
                  
                    
                      
                        β
                        ^
                      
                    
                  
                  )
                
              
            
          
        
      
    
    {\displaystyle {\begin{aligned}\operatorname {Var} \left({\tilde {\beta }}\right)&=\operatorname {Var} (Cy)\\&=C{\text{ Var}}(y)C'\\&=\sigma ^{2}CC'\\&=\sigma ^{2}\left((X'X)^{-1}X'+D\right)\left(X(X'X)^{-1}+D'\right)\\&=\sigma ^{2}\left((X'X)^{-1}X'X(X'X)^{-1}+(X'X)^{-1}X'D'+DX(X'X)^{-1}+DD'\right)\\&=\sigma ^{2}(X'X)^{-1}+\sigma ^{2}(X'X)^{-1}(DX)'+\sigma ^{2}DX(X'X)^{-1}+\sigma ^{2}DD'\\&=\sigma ^{2}(X'X)^{-1}+\sigma ^{2}DD'&&DX=0\\&=\operatorname {Var} \left({\widehat {\beta }}\right)+\sigma ^{2}DD'&&\sigma ^{2}(X'X)^{-1}=\operatorname {Var} \left({\widehat {\beta }}\right)\end{aligned}}}
  Since DD' is a positive semidefinite matrix, 
  
    
      
        Var
        ⁡
        
          (
          
            
              
                β
                ~
              
            
          
          )
        
      
    
    {\displaystyle \operatorname {Var} \left({\tilde {\beta }}\right)}
   exceeds 
  
    
      
        Var
        ⁡
        
          (
          
            
              
                β
                ^
              
            
          
          )
        
      
    
    {\displaystyle \operatorname {Var} \left({\widehat {\beta }}\right)}
   by a positive semidefinite matrix.

Remarks on the proof
As it has been stated before, the condition of 
  
    
      
        Var
        ⁡
        
          (
          
            
              
                β
                ~
              
            
          
          )
        
        −
        Var
        ⁡
        
          (
          
            
              
                β
                ^
              
            
          
          )
        
      
    
    {\displaystyle \operatorname {Var} \left({\tilde {\beta }}\right)-\operatorname {Var} \left({\widehat {\beta }}\right)}
   is a positive semidefinite matrix is equivalent to the property that the best linear unbiased estimator of 
  
    
      
        
          ℓ
          
            t
          
        
        β
      
    
    {\displaystyle \ell ^{t}\beta }
   is 
  
    
      
        
          ℓ
          
            t
          
        
        
          
            
              β
              ^
            
          
        
      
    
    {\displaystyle \ell ^{t}{\widehat {\beta }}}
   (best in the sense that it has minimum variance). To see this, let 
  
    
      
        
          ℓ
          
            t
          
        
        
          
            
              β
              ~
            
          
        
      
    
    {\displaystyle \ell ^{t}{\tilde {\beta }}}
   another linear unbiased estimator of 
  
    
      
        
          ℓ
          
            t
          
        
        β
      
    
    {\displaystyle \ell ^{t}\beta }
  .

  
    
      
        
          
            
              
                Var
                ⁡
                
                  (
                  
                    
                      ℓ
                      
                        t
                      
                    
                    
                      
                        
                          β
                          ~
                        
                      
                    
                  
                  )
                
              
              
                
                =
                
                  ℓ
                  
                    t
                  
                
                Var
                ⁡
                
                  (
                  
                    
                      
                        β
                        ~
                      
                    
                  
                  )
                
                ℓ
              
            
            
              
              
                
                =
                
                  σ
                  
                    2
                  
                
                
                  ℓ
                  
                    t
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                ℓ
                +
                
                  ℓ
                  
                    t
                  
                
                D
                
                  D
                  
                    t
                  
                
                ℓ
              
            
            
              
              
                
                =
                Var
                ⁡
                
                  (
                  
                    
                      ℓ
                      
                        t
                      
                    
                    
                      
                        
                          β
                          ^
                        
                      
                    
                  
                  )
                
                +
                (
                
                  D
                  
                    t
                  
                
                ℓ
                
                  )
                  
                    t
                  
                
                (
                
                  D
                  
                    t
                  
                
                ℓ
                )
              
              
              
                
                  σ
                  
                    2
                  
                
                
                  ℓ
                  
                    t
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                ℓ
                =
                Var
                ⁡
                
                  (
                  
                    
                      ℓ
                      
                        t
                      
                    
                    
                      
                        
                          β
                          ^
                        
                      
                    
                  
                  )
                
              
            
            
              
              
                
                =
                Var
                ⁡
                
                  (
                  
                    
                      ℓ
                      
                        t
                      
                    
                    
                      
                        
                          β
                          ^
                        
                      
                    
                  
                  )
                
                +
                ‖
                
                  D
                  
                    t
                  
                
                ℓ
                ‖
              
            
            
              
              
                
                ≥
                Var
                ⁡
                
                  (
                  
                    
                      ℓ
                      
                        t
                      
                    
                    
                      
                        
                          β
                          ^
                        
                      
                    
                  
                  )
                
              
            
          
        
      
    
    {\displaystyle {\begin{aligned}\operatorname {Var} \left(\ell ^{t}{\tilde {\beta }}\right)&=\ell ^{t}\operatorname {Var} \left({\tilde {\beta }}\right)\ell \\&=\sigma ^{2}\ell ^{t}(X'X)^{-1}\ell +\ell ^{t}DD^{t}\ell \\&=\operatorname {Var} \left(\ell ^{t}{\widehat {\beta }}\right)+(D^{t}\ell )^{t}(D^{t}\ell )&&\sigma ^{2}\ell ^{t}(X'X)^{-1}\ell =\operatorname {Var} \left(\ell ^{t}{\widehat {\beta }}\right)\\&=\operatorname {Var} \left(\ell ^{t}{\widehat {\beta }}\right)+\|D^{t}\ell \|\\&\geq \operatorname {Var} \left(\ell ^{t}{\widehat {\beta }}\right)\end{aligned}}}
  Moreover, equality holds if and only if 
  
    
      
        
          D
          
            t
          
        
        ℓ
        =
        0
      
    
    {\displaystyle D^{t}\ell =0}
  . We calculate

  
    
      
        
          
            
              
                
                  ℓ
                  
                    t
                  
                
                
                  
                    
                      β
                      ~
                    
                  
                
              
              
                
                =
                
                  ℓ
                  
                    t
                  
                
                
                  (
                  
                    (
                    (
                    
                      X
                      ′
                    
                    X
                    
                      )
                      
                        −
                        1
                      
                    
                    
                      X
                      ′
                    
                    +
                    D
                    )
                    Y
                  
                  )
                
              
              
              
                
                   from above
                
              
            
            
              
              
                
                =
                
                  ℓ
                  
                    t
                  
                
                (
                
                  X
                  ′
                
                X
                
                  )
                  
                    −
                    1
                  
                
                
                  X
                  ′
                
                Y
                +
                
                  ℓ
                  
                    t
                  
                
                D
                Y
              
            
            
              
              
                
                =
                
                  ℓ
                  
                    t
                  
                
                
                  
                    
                      β
                      ^
                    
                  
                
                +
                (
                
                  D
                  
                    t
                  
                
                ℓ
                
                  )
                  
                    t
                  
                
                Y
              
            
            
              
              
                
                =
                
                  ℓ
                  
                    t
                  
                
                
                  
                    
                      β
                      ^
                    
                  
                
              
              
              
                
                  D
                  
                    t
                  
                
                ℓ
                =
                0
              
            
          
        
      
    
    {\displaystyle {\begin{aligned}\ell ^{t}{\tilde {\beta }}&=\ell ^{t}\left(((X'X)^{-1}X'+D)Y\right)&&{\text{ from above}}\\&=\ell ^{t}(X'X)^{-1}X'Y+\ell ^{t}DY\\&=\ell ^{t}{\widehat {\beta }}+(D^{t}\ell )^{t}Y\\&=\ell ^{t}{\widehat {\beta }}&&D^{t}\ell =0\end{aligned}}}
  This proves that the equality holds if and only if 
  
    
      
        
          ℓ
          
            t
          
        
        
          
            
              β
              ~
            
          
        
        =
        
          ℓ
          
            t
          
        
        
          
            
              β
              ^
            
          
        
      
    
    {\displaystyle \ell ^{t}{\tilde {\beta }}=\ell ^{t}{\widehat {\beta }}}
   which gives the uniqueness of the OLS estimator as a BLUE.

Generalized least squares estimator
The generalized least squares (GLS), developed by Aitken, extends the Gauss–Markov theorem to the case where the error vector has a non-scalar covariance matrix. The Aitken estimator is also a BLUE.

Gauss–Markov theorem as stated in econometrics
In most treatments of OLS, the regressors (parameters of interest) in the design matrix 
  
    
      
        
          X
        
      
    
    {\displaystyle \mathbf {X} }
   are assumed to be fixed in repeated samples. This assumption is considered inappropriate for a predominantly nonexperimental science like econometrics. Instead, the assumptions of the Gauss–Markov theorem are stated conditional on 
  
    
      
        
          X
        
      
    
    {\displaystyle \mathbf {X} }
  .

Linearity
The dependent variable is assumed to be a linear function of the variables specified in the model. The specification must be linear in its parameters. This does not mean that there must be a linear relationship between the independent and dependent variables. The independent variables can take non-linear forms as long as the parameters are linear.  The equation 
  
    
      
        y
        =
        
          β
          
            0
          
        
        +
        
          β
          
            1
          
        
        
          x
          
            2
          
        
        ,
      
    
    {\displaystyle y=\beta _{0}+\beta _{1}x^{2},}
   qualifies as linear while 
  
    
      
        y
        =
        
          β
          
            0
          
        
        +
        
          β
          
            1
          
          
            2
          
        
        x
      
    
    {\displaystyle y=\beta _{0}+\beta _{1}^{2}x}
   can be transformed to be linear by replacing 
  
    
      
        
          β
          
            1
          
          
            2
          
        
      
    
    {\displaystyle \beta _{1}^{2}}
   by another parameter, say 
  
    
      
        γ
      
    
    {\displaystyle \gamma }
  . An equation with a parameter dependent on an independent variable does not qualify as linear, for example 
  
    
      
        y
        =
        
          β
          
            0
          
        
        +
        
          β
          
            1
          
        
        (
        x
        )
        ⋅
        x
      
    
    {\displaystyle y=\beta _{0}+\beta _{1}(x)\cdot x}
  , where 
  
    
      
        
          β
          
            1
          
        
        (
        x
        )
      
    
    {\displaystyle \beta _{1}(x)}
   is a function of 
  
    
      
        x
      
    
    {\displaystyle x}
  .
Data transformations are often used to convert an equation into a linear form. For example, the Cobb–Douglas function—often used in economics—is nonlinear:

  
    
      
        Y
        =
        A
        
          L
          
            α
          
        
        
          K
          
            1
            −
            α
          
        
        
          e
          
            ε
          
        
      
    
    {\displaystyle Y=AL^{\alpha }K^{1-\alpha }e^{\varepsilon }}
  But it can be expressed in linear form by taking the natural logarithm of both sides:

  
    
      
        ln
        ⁡
        Y
        =
        ln
        ⁡
        A
        +
        α
        ln
        ⁡
        L
        +
        (
        1
        −
        α
        )
        ln
        ⁡
        K
        +
        ε
        =
        
          β
          
            0
          
        
        +
        
          β
          
            1
          
        
        ln
        ⁡
        L
        +
        
          β
          
            2
          
        
        ln
        ⁡
        K
        +
        ε
      
    
    {\displaystyle \ln Y=\ln A+\alpha \ln L+(1-\alpha )\ln K+\varepsilon =\beta _{0}+\beta _{1}\ln L+\beta _{2}\ln K+\varepsilon }
  This assumption also covers specification issues: assuming that the proper functional form has been selected and there are no omitted variables.
One should be aware, however, that the parameters that minimize the residuals of the transformed equation do not necessarily minimize the residuals of the original equation.

Strict exogeneity
For all 
  
    
      
        n
      
    
    {\displaystyle n}
   observations, the expectation—conditional on the regressors—of the error term is zero:

  
    
      
        E
        ⁡
        [
        
        
          ε
          
            i
          
        
        ∣
        
          X
        
        ]
        =
        E
        ⁡
        [
        
        
          ε
          
            i
          
        
        ∣
        
          
            x
          
          
            1
          
        
        ,
        …
        ,
        
          
            x
          
          
            n
          
        
        ]
        =
        0.
      
    
    {\displaystyle \operatorname {E} [\,\varepsilon _{i}\mid \mathbf {X} ]=\operatorname {E} [\,\varepsilon _{i}\mid \mathbf {x} _{1},\dots ,\mathbf {x} _{n}]=0.}
  where 
  
    
      
        
          
            x
          
          
            i
          
        
        =
        
          
            
              [
              
                
                  
                    
                      x
                      
                        i
                        1
                      
                    
                  
                  
                    
                      x
                      
                        i
                        2
                      
                    
                  
                  
                    ⋯
                  
                  
                    
                      x
                      
                        i
                        k
                      
                    
                  
                
              
              ]
            
          
          
            
              T
            
          
        
      
    
    {\displaystyle \mathbf {x} _{i}={\begin{bmatrix}x_{i1}&x_{i2}&\cdots &x_{ik}\end{bmatrix}}^{\mathsf {T}}}
   is the data vector of regressors for the ith observation, and consequently 
  
    
      
        
          X
        
        =
        
          
            
              [
              
                
                  
                    
                      
                        x
                      
                      
                        1
                      
                      
                        
                          T
                        
                      
                    
                  
                  
                    
                      
                        x
                      
                      
                        2
                      
                      
                        
                          T
                        
                      
                    
                  
                  
                    ⋯
                  
                  
                    
                      
                        x
                      
                      
                        n
                      
                      
                        
                          T
                        
                      
                    
                  
                
              
              ]
            
          
          
            
              T
            
          
        
      
    
    {\displaystyle \mathbf {X} ={\begin{bmatrix}\mathbf {x} _{1}^{\mathsf {T}}&\mathbf {x} _{2}^{\mathsf {T}}&\cdots &\mathbf {x} _{n}^{\mathsf {T}}\end{bmatrix}}^{\mathsf {T}}}
   is the data matrix or design matrix.
Geometrically, this assumption implies that 
  
    
      
        
          
            x
          
          
            i
          
        
      
    
    {\displaystyle \mathbf {x} _{i}}
   and 
  
    
      
        
          ε
          
            i
          
        
      
    
    {\displaystyle \varepsilon _{i}}
   are orthogonal to each other, so that their inner product (i.e., their cross moment) is zero.

  
    
      
        E
        ⁡
        [
        
        
          
            x
          
          
            j
          
        
        ⋅
        
          ε
          
            i
          
        
        
        ]
        =
        
          
            [
            
              
                
                  E
                  ⁡
                  [
                  
                  
                    
                      x
                    
                    
                      j
                      1
                    
                  
                  ⋅
                  
                    ε
                    
                      i
                    
                  
                  
                  ]
                
              
              
                
                  E
                  ⁡
                  [
                  
                  
                    
                      x
                    
                    
                      j
                      2
                    
                  
                  ⋅
                  
                    ε
                    
                      i
                    
                  
                  
                  ]
                
              
              
                
                  ⋮
                
              
              
                
                  E
                  ⁡
                  [
                  
                  
                    
                      x
                    
                    
                      j
                      k
                    
                  
                  ⋅
                  
                    ε
                    
                      i
                    
                  
                  
                  ]
                
              
            
            ]
          
        
        =
        
          0
        
        
        
          for all 
        
        i
        ,
        j
        ∈
        n
      
    
    {\displaystyle \operatorname {E} [\,\mathbf {x} _{j}\cdot \varepsilon _{i}\,]={\begin{bmatrix}\operatorname {E} [\,{x}_{j1}\cdot \varepsilon _{i}\,]\\\operatorname {E} [\,{x}_{j2}\cdot \varepsilon _{i}\,]\\\vdots \\\operatorname {E} [\,{x}_{jk}\cdot \varepsilon _{i}\,]\end{bmatrix}}=\mathbf {0} \quad {\text{for all }}i,j\in n}
  This assumption is violated if the explanatory variables are measured with error, or are endogenous. Endogeneity can be the result of simultaneity, where causality flows back and forth between both the dependent and independent variable. Instrumental variable techniques are commonly used to address this problem.

Full rank
The sample data matrix 
  
    
      
        
          X
        
      
    
    {\displaystyle \mathbf {X} }
   must have full column rank.

  
    
      
        rank
        ⁡
        (
        
          X
        
        )
        =
        k
      
    
    {\displaystyle \operatorname {rank} (\mathbf {X} )=k}
  Otherwise 
  
    
      
        
          
            X
          
          ′
        
        
          X
        
      
    
    {\displaystyle \mathbf {X} '\mathbf {X} }
   is not invertible and the OLS estimator cannot be computed.
A violation of this assumption is perfect multicollinearity, i.e. some explanatory variables are linearly dependent. One scenario in which this will occur is called "dummy variable trap," when a base dummy variable is not omitted resulting in perfect correlation between the dummy variables and the constant term.Multicollinearity (as long as it is not "perfect") can be present resulting in a less efficient, but still unbiased estimate. The estimates will be less precise and highly sensitive to particular sets of data. Multicollinearity can be detected from condition number or the variance inflation factor, among other tests.

Spherical errors
The outer product of the error vector must be spherical.

  
    
      
        E
        ⁡
        [
        
        
          ε
        
        
          
            ε
            
              
                T
              
            
          
        
        ∣
        
          X
        
        ]
        =
        Var
        ⁡
        [
        
        
          ε
        
        ∣
        
          X
        
        ]
        =
        
          
            [
            
              
                
                  
                    σ
                    
                      2
                    
                  
                
                
                  0
                
                
                  ⋯
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    σ
                    
                      2
                    
                  
                
                
                  ⋯
                
                
                  0
                
              
              
                
                  ⋮
                
                
                  ⋮
                
                
                  ⋱
                
                
                  ⋮
                
              
              
                
                  0
                
                
                  0
                
                
                  ⋯
                
                
                  
                    σ
                    
                      2
                    
                  
                
              
            
            ]
          
        
        =
        
          σ
          
            2
          
        
        
          I
        
        
        
          with 
        
        
          σ
          
            2
          
        
        >
        0
      
    
    {\displaystyle \operatorname {E} [\,{\boldsymbol {\varepsilon }}{\boldsymbol {\varepsilon ^{\mathsf {T}}}}\mid \mathbf {X} ]=\operatorname {Var} [\,{\boldsymbol {\varepsilon }}\mid \mathbf {X} ]={\begin{bmatrix}\sigma ^{2}&0&\cdots &0\\0&\sigma ^{2}&\cdots &0\\\vdots &\vdots &\ddots &\vdots \\0&0&\cdots &\sigma ^{2}\end{bmatrix}}=\sigma ^{2}\mathbf {I} \quad {\text{with }}\sigma ^{2}>0}
  This implies the error term has uniform variance (homoscedasticity) and no serial correlation. If this assumption is violated, OLS is still unbiased, but inefficient. The term "spherical errors" will describe the multivariate normal distribution: if 
  
    
      
        Var
        ⁡
        [
        
        
          ε
        
        ∣
        
          X
        
        ]
        =
        
          σ
          
            2
          
        
        
          I
        
      
    
    {\displaystyle \operatorname {Var} [\,{\boldsymbol {\varepsilon }}\mid \mathbf {X} ]=\sigma ^{2}\mathbf {I} }
   in the multivariate normal density, then the equation 
  
    
      
        f
        (
        ε
        )
        =
        c
      
    
    {\displaystyle f(\varepsilon )=c}
   is the formula for a ball centered at μ with radius σ in n-dimensional space.Heteroskedasticity occurs when the amount of error is correlated with an independent variable. For example, in a regression on food expenditure and income, the error is correlated with income.  Low income people generally spend a similar amount on food, while high income people may spend a very large amount or as little as low income people spend. Heteroskedastic can also be caused by changes in measurement practices. For example, as statistical offices improve their data, measurement error decreases, so the error term declines over time.
This assumption is violated when there is autocorrelation.  Autocorrelation can be visualized on a data plot when a given observation is more likely to lie above a fitted line if adjacent observations also lie above the fitted regression line. Autocorrelation is common in time series data where a data series may experience "inertia." If a dependent variable takes a while to fully absorb a shock. Spatial autocorrelation can also occur geographic areas are likely to have similar errors. Autocorrelation may be the result of misspecification such as choosing the wrong functional form. In these cases, correcting the specification is one possible way to deal with autocorrelation.
In the presence of spherical errors, the generalized least squares estimator can be shown to be BLUE.

See also
Independent and identically distributed random variables
Linear regression
Measurement uncertainty

Other unbiased statistics
Best linear unbiased prediction (BLUP)
Minimum-variance unbiased estimator (MVUE)

References
Further reading
Davidson, James (2000). "Statistical Analysis of the Regression Model". Econometric Theory. Oxford: Blackwell. pp. 17–36. ISBN 0-631-17837-6.
Goldberger, Arthur (1991). "Classical Regression". A Course in Econometrics. Cambridge: Harvard University Press. pp. 160–169. ISBN 0-674-17544-1.
Theil, Henri (1971). "Least Squares and the Standard Linear Model". Principles of Econometrics. New York: John Wiley & Sons. pp. 101–162. ISBN 0-471-85845-5.

External links
Earliest Known Uses of Some of the Words of Mathematics: G (brief history and explanation of the name)
Proof of the Gauss Markov theorem for multiple linear regression (makes use of matrix algebra)
A Proof of the Gauss Markov theorem using geometry