Regression using Linear Algebra (for univariate inputs)

Regression aims to find the best fit of a function from a set of given data points. Suppose we want to fit n data points to y, where y is a function of x.

y=a0+a1x+a2x2adxd

We have n data points

X=(x0x1xn)Y=(y0y1yn)

Vandermonde Matrix

A Vandermonde Matrix is defined as such. It describes a polynomial function of degree d. #Vandermonde_Matrix

X~=V(x0,x1,x2,xn)=(1x0x02x0d1x1x12x1d1xnxn2xnd)

y can be re-expressed as

Y=X~A

where

A=(a0a1a2ad)

To solve for A, X^ typically does not have an inverse as dn+1. However, we can multiply the Vandermonde matrix by its transpose, thus "squaring" it, which allows us to solve for its inverse.

X~TY=(X~TX~)AA=(X~TX~)1X~TY