fill in given code to plot graphs.
change 'inv' function to 'pinv' (because X' * X may be non-invertible)