ArticleslgStudy

mathematics

Linear least squares

Linear least squares is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Linear least squares rather than just read about it. In short: Linear least squares (LLS) is the least squares approximation of linear functions to data. It is a set of formulations for solving statistical problems involved in linear regression, including variants for ordinary (unweighted), weighted, and generalized (correlated) residuals.

Linear least squares — main illustration
Linear least squares — illustration

Key takeaways

  • Linear least squares belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Linear least squares to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Linear least squares from memory before moving on to harder problems.

Reference excerpt

Linear least squares (LLS) is the least squares approximation of linear functions to data. It is a set of formulations for solving statistical problems involved in linear regression, including variants for ordinary (unweighted), weighted, and generalized (correlated) residuals. Numerical methods for linear least squares include inverting the matrix of the normal equations and orthogonal decomposition methods.

Basic formulation Consider the linear equation

where A ∈ R m × n {\displaystyle A\in \mathbb {R} ^{m\times n}} and b ∈ R m {\displaystyle b\in \mathbb {R} ^{m}} are given and x ∈ R n {\displaystyle x\in \mathbb {R} ^{n}} is a variable to be computed. When m > n , {\displaystyle m>n,} it is generally the case that (1) has no solution. For example, there is no value of x {\displaystyle x} that satisfies

[ 1 0 0 1 1 1 ] x = [ 1 1 0 ] , {\displaystyle {\begin{bmatrix}1&0\\0&1\\1&1\end{bmatrix}}x={\begin{bmatrix}1\\1\\0\end{bmatrix}},}

because the first two rows require that x = ( 1 , 1 ) , {\displaystyle x=(1,1),} but then the third row is not satisfied. Thus, for m > n , {\displaystyle m>n,} the goal of solving (1) exactly is typically replaced by finding the value of x {\displaystyle x} that minimizes some error. There are many ways that the error can be defined, but one of the most common is to define it as ‖ A x − b ‖ 2 . {\displaystyle \|Ax-b\|^{2}.}

This produces a minimization problem, called a least squares problem

The solution to the least squares problem (1) is computed by solving the normal equation

where A ⊤ {\displaystyle A^{\top }} denotes the transpose of A {\displaystyle A} . Continuing the example, above, with

A = [ 1 0 0 1 1 1 ] and b = [ 1 1 0 ] , {\displaystyle A={\begin{bmatrix}1&0\\0&1\\1&1\end{bmatrix}}\quad {\text{and}}\quad b={\begin{bmatrix}1\\1\\0\end{bmatrix}},}

we find

A ⊤ A = [ 1 0 1 0 1 1 ] [ 1 0 0 1 1 1 ] = [ 2 1 1 2 ] {\displaystyle A^{\top }A={\begin{bmatrix}1&0&1\\0&1&1\end{bmatrix}}{\begin{bmatrix}1&0\\0&1\\1&1\end{bmatrix}}={\begin{bmatrix}2&1\\1&2\end{bmatrix}}}

and

… excerpt ends here. Continue reading the full article.

Illustrations

Linear least squares: A plot of the data points (in red), the least squares line of best fit (in blue), and the residuals (in green)
A plot of the data points (in red), the least squares line of best fit (in blue), and the residuals (in green)
Linear least squares: The result of fitting a quadratic function 
  
    
      
        y
        =
        
          β
          
            1
          
        
        +
        
          β
          
            2
          
        
        x
        +
        
          β
          
            3
          
        
        
          x
          
            2
          
        
        
      
    
    {\displaystyle y=\beta _{1}+\beta _{2}x+\beta _{3}x^{2}\,}
  
 (in blue) through a set of data points 
  
    
      
        (
        
          x
          
            i
          
        
        ,
        
          y
          
            i
          
        
        )
      
    
    {\displaystyle (x_{i},y_{i})}
  
 (in red). In linear least squares the function need not be linear in the argument 
  
    
      
        x
        ,
      
    
    {\displaystyle x,}
  
 but only in the parameters 
  
    
      
        
          β
          
            j
          
        
      
    
    {\displaystyle \beta _{j}}
  
 that are determined to give the best fit.
The result of fitting a quadratic function y = β 1 + β 2 x + β 3 x 2 {\displaystyle y=\beta _{1}+\beta _{2}x+\beta _{3}x^{2}\,} (in blue) through a set of data points ( x i , y i ) {\displaystyle (x_{i},y_{i})} (in red). In linear least squares the function need not be linear in the argument x , {\displaystyle x,} but only in the parameters β j {\displaystyle \beta _{j}} that are determined to give the best fit.

Worked examples

Example 1 — a first encounter with Linear least squares

Start with the simplest possible case. Write down what Linear least squares claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Linear least squares before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Linear least squares ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Linear least squares

In research
Linear least squares appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Linear least squares in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Linear least squares is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational statistics, Least squares, so understanding it makes those chapters shorter.
In everyday life
Look for Linear least squares outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Linear least squares in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Linear least squares means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Linear least squares out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Linear least squares in simple terms?

Linear least squares (LLS) is the least squares approximation of linear functions to data. It is a set of formulations for solving statistical problems involved in linear regression, including variants for ordinary (unweighted), weighted, and generalized (correlated) residuals.

Why does Linear least squares matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Linear least squares?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Linear least squares.

Tags

  • Computational statistics
  • Least squares

Keep exploring