How do you distinguish the difference between a negative sign and a minus sign in Algebra Both the negative sign symbol and subtraction's minus symbol look the same, so how does anyone tell them apart? 
 A: Excerpt from Wikipedia: +/-#-.

The minus sign has three main uses in mathematics:

*

*The subtraction operator: A binary operator to indicate the operation of subtraction, as in $5 − 3 = 2$. Subtraction is the inverse of addition.

*Directly in front of a number and when it is not a subtraction operator it means a negative number. For instance $−5$ is negative $5$.

*A unary operator that acts as an instruction to replace the operand by its opposite. For example, if $x$ is $3$, then $−x$ is $−3$, but if $x$ is $−3$, then $−x$ is $3$. Similarly, $−(−2)$ is equal to $2$.


Comment:

*

*If you have numbers or variables on both sides of symbol $-$ then it means substraction.

*If you have no number or variables before the symbol $-$ then it means negation. Beware: parenthesis aren't variables.

A: I beg to differ with the wikipedia description, which seems to be written for the feeble of mind, but does not describe the use of the sign "$-$" in mathematics, or in computer programming, correctly. Notably there is no need at all to distinguish the use of a "negative indicator" (case 2., as in $-5$) from the use as a (unary) "negation operator" (case 3. ,as in $-x$, or I suppose for instance in $-\pi$ or in $-i$ when $i$ designates the imaginary unit). One can of course decree that case 2. applies if and only if the sign "$-$" has no left operand and a right operand that is an explicit numeric constant (a sequence of digits, possible fractional part starting with  decimal point); one then needs to remove that case from case 3. to avoid ambiguity. But the point is that case 3. perfectly well covers cases like $-5$ or $-5.272023$: the value denoted is the opposite of that of the (right) operand of the minus sign. Saying that case 2. is a "negative sign" has no added value; it just happens that explicit numeric constants as described above always designate non-negative numbers, so that particular case always describes a non-positive real number. Making the distinction just raises useless questions like whether there is a negative indicator in $-\frac15$, and in $-1/5$? Or in $-0.00$, which is no more negative than $0$ is positive. Therefore I would say


*

*There is no such thing as a negative sign in mathematics. To expresss the fact that the value of an expression $E$ is negative, one writes $E<0$, and this does not involve the sign "$-$" at all.

*The basic meaning of "$-$" is as a binary operator, where $x-y$ describes the unique value $z$ such that $z+y=x$.

*When used without a left operand (so as a unary operator) the value $0$ is implicitly taken as left operand. So $-x$ means $0-x$. And $-5$ means $0-5$, the unique value $z$ such that $z+5=0$, which might seem roundabout, but is correct.
The fact that $-5$ is not an explicit constant expression like $24$, but the resultof applying a unary operator to "$5$", and that the value denoted by "$-5$" does not have any direct numeric representation should not be shocking; neither do $\pi$  or $\frac17$ (because decimals have to stop somewhere) or $3+4i$ have any numeric constant designating them, without using operators. As far as programming goes, I hardly know any language whose syntax for numeric constants allows for $-5$; most if not all would take that to be the unary minus applied to the constant $5$. (However if scientific notation with exponent-of-$10$ is included, the possible minus sign for the exponent will be part of the constant syntax, as an operator makes no sense in that position.)
So the only relevant question is whether "$-$" is used in a specific case as unary or binary operator, which is determined merely by the absence or presence of an applicable left operand; which is the case is quite clear in practice.
I might add that it makes sense in the points above to reverse the order in discussing unary and binary use, making $-x$ the more basic case (the unique value $z$ with $z+x=0$), and considering $x-y$ and abbreviation for $x+-y$; in the end for the meaning of each operator it makes no difference which approach is used.
A: The sign "-" as a unary operator is derived from the fundamental definitions. This is usually done in the framework of abelian groups where the basic operation is "+". By definition there is an identity (additive) denoted by say $0$: $a+0=a$. Also each element has an additive inverse say $a'$: $a+a'=0$. This invese is unique. So we write $-a$ instead of $a'$. $b-a$ is by definition $b+(-a)$. And we can extend to any number of elements and operations. 
Manas
A: The same way we distinguish different meanings of ‘$\cdot$’, for instance (e.g., $x\cdot y$, meaning ordinary multiplication of real numbers $a$ and $b$; $\vec a\cdot\vec y$, meaning the dot product of vectors $\vec x$ and $\vec y$; $\|\cdot\|$, in which the dot is a place-holder): by context. It’s no different from dealing with the problem in English of distinguishing various quite different meanings of strike, including ‘a labor action’ and the baseball player’s strike that occurs when he swings and does not manage to strike the ball.
Everyday language is full of words with multiple meanings, sometimes even contradictory meanings (cleave ‘to cut something’ and cleave ‘to adhere’). Mathematical language may perhaps suffer a bit less from such overloading, but it’s far from immune: just look at the overloading of the words regular and normal. The same goes for mathematical notation; the use of a single symbol for unary and binary minus is just one of the most familiar examples. And in all of these settings the answer to your question is that we rely on the context to disambiguate the word or symbol. This generally works quite well, especially in mathematics; occasionally it fails.
In the specific case under discussion, the most relevant contextual clue is simply the number of operands associated with the $-$: if there are two, as in $a-b$, it’s the binary operator of subtraction; if there is just one, as is clear from the parenthesis in $a(-b)$, it’s the unary operator of taking the additive inverse.
