When does the equality hold in the triangle inequality? [duplicate]

Hi guys could you please help me on this question I'm confused.

question: when does the equality hold in the triangle inequality:

my attempt :

$|x + y| \leq |x| + |y|$ this implies

$(|x+y|)^2 = (|x| + |y|)^2 \Rightarrow (x+y)^2 = (|x| + |y|)^2 \Rightarrow x^2 + 2xy + y^2 = |x|^2 + 2|x||y| + |y| ^2 $

since $x^2 = |x|^2$

$\Rightarrow 2xy = 2|x||y| \Rightarrow xy = |x||y| $

and $|x \cdot y| = |x| \cdot |y| \text{ iff } x = y$

therefore $xy = |xy| \Rightarrow xx = |xx| \Rightarrow x^2 = |x|^2 \Rightarrow x=x $

that is what I did so far, I wanted to know if I did this write or if there is a better way in showing this inequality and also what conditions does it hold? I am really confused on that one. This question was on our past quizzes we have a quiz coming up so I wanted to do all the questions and be prepared.

Thank you in advance


Solution 1:

You are correct up to the point where you have $$xy = |x||y| = |xy|$$ The correct implication is $$\Leftrightarrow xy \ge 0 \Leftrightarrow x, y \ge 0 \vee x, y \le 0$$ So equality holds if $x$ and $y$ have the same sign or at least one of them is equal to $0$.

Solution 2:

It is not even remotely true that $|xy| = |x||y|$ implies $x=y$. The equality $|xy|=|x||y|$ holds for any pair of positive real numbers $x,y$. So your proof is incorrect.