I don't get why there's a half in the cost function

$$J(\theta_0, \theta_1) = \frac{1}{2} \sum_{i=1}^m(h_\theta(x^{(i)}) - y^{(i)})^2$$


closed as off-topic by Did, vonbrand, Winther, user91500, Claude Leibovici Sep 3 '15 at 6:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Did, vonbrand, Winther, user91500, Claude Leibovici
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Your audience is probably not familiar with the notation used here. Anyway, a $1/2$ in front of a sum of squares is often present not because it is essential but rather "for beauty" because when you differentiate it cancels out. $\| x \|^2_A = \frac{1}{2} x^T A x$ is a similar convention. $\endgroup$ – Ian Sep 2 '15 at 20:23
  • $\begingroup$ For instance, I like to take the $\ell_2$ norm normalized by a factor $\frac{1}{\sqrt{\log \pi}}$ :D $\endgroup$ – Jack D'Aurizio Sep 2 '15 at 20:33
  • 1
    $\begingroup$ If you use the factor of $1/2$, the relationship between a symmetric quadratic optimization problem and its associated linear system becomes cleaner. That is, the stationary point of the quadratic function $f(x)=\frac{1}{2}x^T A x - b^T x$ is the solution to the system $Ax=b$ $\endgroup$ – Nick Alger Sep 2 '15 at 20:59

Browse other questions tagged or ask your own question.