# Why do people prefer $(target-actual)^2$ over $|(target-actual)|$ [duplicate]

When computing loss functions, people use $$(target-actual)^2$$. They sqaure it to prevent any negative loss. But we can even use $$|(target-actual)|$$ to prevent any negative loss. So, why do people prefer the first option more than the second?

In principle you can also have a negative loss. The point is without the square, you have $$(x-y) \neq (y-x)$$ for $$x \neq y$$. In particular, the loss would not be symmetric and for $$x = 0$$, you have $$(x-y) = -y$$. So by increasing $$y$$ you decrease the loss. The loss would thus not be lower bounded so that there is no global minimum for the loss.
• If you minimize $\sum_{i} ||\mathrm{target}_{i}-\mathrm{actual}_{i}||_{2}^{2}-\theta_{i}$, where $\theta = \theta_{i} > 0$ is fixed. you will get the same optimal result and the loss can have negative values. – Graph4Me Consultant Sep 23 at 13:24
• ok, may be replace "loss" with "objective function". But still my point is that without the square, computing $x-y$ is completely wrong (and this is not due to negative values) but as it is not measuring anything usefull. – Graph4Me Consultant Sep 23 at 13:41