How come there are two forms to the coefficient of determination? On Wikipedia, it says:
$$
R^{2}= 1-{\sum _{i}(y_{i}-f_{i})^{2} \over \sum _{i}(y_{i}-{\bar {y}})^{2}}
$$
However, on other sites, R is defined as the following:
$$
R = { n({\sum xy})-({\sum x})({\sum y})\over {\sqrt {(n{{\sum(x^2)-({\sum x})^2})(n{{\sum(y^2)-({\sum y})^2})}}}}}
$$
and $R^2 = R \times R$
Am I missing something? In which circumstance am I supposed to use one versus the other?
(I'm trying to find $R^2$ for a polynomial regression)
 A: *

*The more general expression is your first one: $R^{2}= 1-{\sum _{i}(y_{i}-f_{i})^{2} \over \sum _{i}(y_{i}-{\bar {y}})^{2}}$

*Your second one is equivalent in the special case of simple linear regression (one right hand side variable and an intercept), that is:
$$y_i = a + b x_i + \epsilon_i$$
In this special case, $R^2$ is given by the square of the sample correlation coefficient between  $Y$ and $X$, and $R$ as defined above is the sample correlation coefficient between $Y$ and $X$. (The fitted values are given by $f_i = a + bx_i$.)
More detailed algebra showing $R$ is the sample correlation coefficient
Let $\mu_x = \frac{1}{n} \sum_i x_i$ be the sample mean. Let's unpack your 2nd expression:
\begin{align*}
R &= \frac{ n\left({\sum xy}\right)-\left({\sum x}\right)\left({\sum y}\right)}{\sqrt{\left(n \sum x^2 - \left(  \sum x\right)^2 \right)\left(n \sum y^2 - \left( \sum y\right)^2 \right)}} \\
&= \frac{ \frac{1}{n}\sum xy - \mu_x \mu_y}{\sqrt{\left( \frac{1}{n} \sum x^2 - \mu^2_x \right) \left( \frac{1}{n}\sum y^2 - \mu^2_y \right) }} \\
&= \frac{ \frac{1}{n}\sum (x - \mu_x)(y- \mu_y)}{\sqrt{\frac{1}{n} \sum \left( x - \mu_x \right)^2  \frac{1}{n}\sum   (y - \mu_y)^2  }}
\end{align*}
