I'm in High School and my textbooks have like skipped a lesson of modulus,i.e. $|x|$ in previous classes. I know that $$|-4|=4 $$ but how does
$$|x|=\begin{cases} x &\text{ if } x\geq0\\-x&\text{ if } x<0\end{cases}$$
This negative value of $x$ is what I don't get. If modulus gives positive values, how can $f(x)$ give a negative value?
Ps: I have found these problems while learning sets.
The definition might seem confusing at first, but it is in fact very logical: $$|x| = \begin{cases} x & x \ge 0 \\ -x & x< 0\end{cases}$$ You should read this as follows:
Indeed: when $x$ is negative, $-x$ is positive!
Take an example, for $x = -3$ you would get: $$|\color{red}{-3}| = -(\color{red}{-3}) = 3$$
Or put differently: we probably think of $|-3|=3$ as "dropping the minus sign", but that's hard to put into symbols if we want to write down a symbolical definition. We can however easily add an extra minus and of course this achieves the exact same thing since $-(-x) = x$.