<p>To simplify the derivative, probably. Otherwise there will be constant 2 in it. </p>

CC BY-SA 4.0
2019-04-01T13:56:49.717Z
I think it would also useful if you explain in which way it exactly simplifies the derivative (i.e. show a step by step example).
nbro
CC BY-SA 4.0
2019-04-01T14:02:25.880Z
@Harsh Yes, but I think these details should be elaborated a little more (i.e. explained more in detail), given that they might not obvious to everyone, so this question needs to be improved, IMHO.
nbro
CC BY-SA 3.0
2017-02-23T21:16:10.053Z
This is the correct answer. The constant factor does not affect the optimizer of the loss, so the only reason is convenience.
Harsh
CC BY-SA 3.0
2017-02-23T15:17:53.180Z
2017-02-23T15:17:53.180Z
avysk
<p>A cost function used in machine is often the following</p>

<p><span class="math-container">$$C = \frac{1}{2} \| y - \hat{y} \| ^2$$</span></p>

<p>Why is there <span class="math-container">$\frac{1}{2}$</span> in front of the squared distance?</p>

CC BY-SA 4.0
2019-04-01T15:02:48.157Z
See also https://math.stackexchange.com/q/884887/168764 for more elaborate and precise answers.
nbro
<neural-networks><machine-learning><math>
Why does the cost function contain a 2 at the denominator?
Dmytro Nalyvaiko
# Why does the cost function contain a 2 at the denominator?

(Asked by: username_0 on 2017-02-23)

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?

**Tags:** neural-networks, machine-learning, math

> **Comments:**
> **username_1**: See also https://math.stackexchange.com/q/884887/168764 for more elaborate and precise answers.  

---

## 1 answers

### Answer by username_2 on 2017-02-23. Score: 4

To simplify the derivative, probably. Otherwise there will be constant 2 in it.

> **Comments:**
> **username_3**: This is the correct answer. The constant factor does not affect the optimizer of the loss, so the only reason is convenience.  
> **username_1**: I think it would also useful if you explain in which way it exactly simplifies the derivative (i.e. show a step by step example).  
> **username_1**: @username_3 Yes, but I think these details should be elaborated a little more (i.e. explained more in detail), given that they might not obvious to everyone, so this question needs to be improved, IMHO.  

---

