I'm studying PCA and my professor said something about finding the linear regression by doing the dot product of both axis. Could someone explain to me why? The dot product returns a number. What's the relationship between that number and the linear regression?

In my example, I have two vectors

$stat\_grade = [0,1,3,7,10]$

$physics\_grade = [1,5,8,10,10]$

The first step is normalizing them:

$ \frac{stat\_grade - mean(stat\_grade)}{std(stat\_grade)} = [-1.69131435 -0.52489066 0.34992711 0.93313895 0.93313895]$

$ \frac{physics\_grade - mean(physics\_grade)}{std(physics\_grade)} = [-1.11613741 -0.85039041 -0.3188964 0.7440916 1.54133261]$

Computing the dot product between the normalized vectors will return $4.355129045906131$

I can't understand how a single number can help me to find the linear regression

Thanks for the response!

  • $\begingroup$ dot product of normalised vectors gives the cosine of the angle one has with the other, thus gives the linear factor in a linear model of one as function of the other $\endgroup$
    – Nikos M.
    Jan 24, 2021 at 17:19
  • 1
    $\begingroup$ en.wikipedia.org/wiki/… $\endgroup$
    – Nikos M.
    Jan 24, 2021 at 17:27
  • $\begingroup$ Therefore the dot product gives the slope of the line? $\endgroup$ Jan 24, 2021 at 17:30
  • $\begingroup$ yes, exactly, gave referencve for simple case, to see it better $\endgroup$
    – Nikos M.
    Jan 24, 2021 at 17:31
  • $\begingroup$ I got it but i will need to find the y intercpet to plot the line right? $\endgroup$ Jan 24, 2021 at 17:52

1 Answer 1


I think the professor might have meant the closed-form solution of linear regression.

  • $\begingroup$ These are also called normal equations (for reference) $\endgroup$
    – liakoyras
    Nov 18, 2022 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.