System of Linear Equations Solution

Learn about the system of linear equations of matrices using R, Rcpp, Armadillo, and Eigen.

System of linear equations

A system of linear equations takes the following form:

𝐴𝑥=𝑏𝐴𝑥 = 𝑏

In this equation:

  • 𝐴𝐴 is a square coefficient matrix.
  • 𝑥𝑥 is the vector of unknowns.
  • 𝑏𝑏 is the RHS (right hand side) vector.

It can be solved by multiplying the inverse of matrix 𝐴𝐴 by RHS constant vector 𝑏𝑏:

𝑥=𝐴1𝑏𝑥 = 𝐴^{−1}𝑏

Let’s suppose, the system of linear equations is formed by two equations and two unknowns:

x1  1x2=22x1 + 2x2=1\begin{alignat}{2} x_1 \space - \space 1*x_2=2\\ 2*x_1 \space + \space 2*x_2 = 1 \end{alignat}

Get hands-on with 1200+ tech skills courses.