Analytical Solution for Linear Regression with one predictor
You might need to install "sudo apt-get install r-cran-rgl" for library matlib to work for inverse function. I use ubuntu so command is given above. For windows, download and install the rgl library.
Have fun!