# Why does the cost function contain a 2 at the denominator?

A cost function used in machine is often the following

$$C = \frac{1}{2} \| y - \hat{y} \| ^2$$

Why is there $$\frac{1}{2}$$ in front of the squared distance?