An oddity in some linear equations Okay, so I've started Algebra I this year, and i've always had a love for math. And at one point in the course we were presented with an equation similar to this one:
$5x + 3 = 8x + 3$
And so I solved it like such: $5x + 3 = 8x + 3$
$5x + 3 - 3 = 8x + 3 -3$
$5x = 8x$
$5x - 5x = 8x - 5x$
$0 = 3x$
$\frac{0}{3} = \frac{3x}{3}$
$0 = x$
However, I also noticed that it seems perfectly valid to divide both sides by x instead of subtracting 5x, which results in 5 = 8, and therefore no solution. I'm a little confused about that. Can someone clarify what exactly is happening here?
 A: $x$ is equal to zero.  It's true that, at the outset, you don't happen to know that $x$ is equal to zero, but what you know isn't relevant.  What's relevant is what $x$  actually is.  Because $x$ is zero, you can't divide by it.
It's a good policy not to divide by things that might be zero, because then you might be doing something invalid, and that will lead to wrong conclusions.  Sometimes those conclusions will be obviously wrong, like $5=8$.  Other times, they'll be non-obviously wrong, which is even worse, because you'll fool yourself into believing false things.
A: Any time you have an equation where both sides have a common factor, like this:
$$ab = ac$$
there will be two possible ways in which the equation could be satisfied: either


*

*$a = 0$, in which case the values of $b$ and $c$ don't matter, or 

*$b = c$, in which case the value of $a$ doesn't matter.


(Of course, it's also perfectly possible that both of those could be true at the same time.)
Note that $a$, $b$ and $c$ here could be any expressions; in your case, $a = x$, $b = 5$ and $c = 8$, but you could just as well have, say, $a = (x + 1)$, $b = \sqrt{2}$ and $c = (3x^2 - 2x + 7)$.
Another, more general way of looking at such equations is to rewrite them equivalently as:
$$ab - ac = 0$$
where all the non-zero terms are on the same side of the equals sign, and then factoring it into a product:
$$a(b - c) = 0$$
Now, remember that the product of two (or more) numbers is zero if and only if at least one of the numbers is zero.  So in this case, the only way $a(b-c)$ can equal $0$ is if either $a=0$ or $(b-c)=0$, which in turn is true if and only if $b=c$.
A: The answer is already in the comments, but I'll try explain it a bit more verbosely. If you solve an equation, what you're actually doing is writing a proof that the equation is logically equivalent to some statement $x = ...$, where the dots stand for some number. You do that by writing down a series of equivalent statements, one below the other. In your case, you start out with $$
  5x + 3 = 8x + 3
$$
Then you subtract $3$ from both sides. You may do that, because two numbers are equal exactly if those numbers minus 3 are equal. So the statement $$
  5x = 8x
$$
is logically equivalent to the equation you started with. Now you divide by $x$. Are you allowed to do that? Is it true that two numbers are equal exactly if they're equal if divided by the same divisor? Turns out they are, except if the divisor is zero. In that case, the division isn't allowed, and so the statement you get - even if it formally looks valid - has no more logical connection to the original equation. In particular, the original equation may have a solution, but the statement you get after the division may be simply untrue. So, by dividing by $x$, you implicitly assume that $x\neq 0$! Everything that follows will be depend on that assumption. In your case, you do the division and end up with $$
  5 = 8 \text{,}
$$
an obvious contradiction. But that statement is only equivalent to the original equation if $x \neq 0$ - after all, we had to assume that to get this far. So we now know that, indeed, $x$ has to be zero for the equation to hold, since assuming that it isn't zero got us into trouble. We don't yet know if it actually will hold for $x=0$, thought, so the last step is to set $x=0$ in the original equation, and verify that it checks out.
A: Contrary to popular belief, it is actually possible to "divide" by something that could be $0$ and get meaningful answers, but doing so requires that you be very, very careful. So careful, in fact, that it isn't worth it and you should just analyze what happens in the cases when $x=0$ and when $x\neq0$ (Incidentally, if you can avoid dividing by something that you don't know is not $0$, it's worth making sure there isn't something else you could do to figure out $x$). 
Nevertheless, if you want to feel badass and divide by things that could be $0$, what you need to do is understand well how fractions work.
What is a fraction? A fraction is an expression of the form $\dfrac ba$ where $b$ and $a$ are numbers. We say that a fraction $\dfrac ba$ stands for a number if when you multiply that number by $a$, you get $b$. There are three types of fractions:


*

*$\dfrac00$ which can stand for any number $a$ since $0a=0$ for all numbers $a$. We say that $\dfrac00$ is an "indeterminate" expression.

*$\dfrac b0$ where $b\neq0$, which cannot stand for any number since $0x=0\neq b$ for all numbers $a$. We might say that $\frac b0$ is an "undefined" expression.

*$\dfrac ba$ where $a\neq0$, which stands for exactly one number since if $ax=b$ and $ay=b$, then subtracting one equation from the other gives $a(y-x)=0$, and since $a\neq0$ we must have $y-x=0$, so $y=x$.


(the reason why "division by $0$" is usually disallowed outright is that the fractions with zeroes in the denominator are all of cases 1. and 2., neither of which stand for exactly one number, whereas the fractions with non-zero denominator are case 3.: each such fraction stands for exactly one number).
Now, when you did your division algebra and divided by $5x=8x$ by $x$ (which is only "allowed" if $x$ is non-zero), it seemed like you got a contradiction that $5=8$. However, if you pay attention, you will notice that the contradiction comes not from assuming that $x\neq0$ so that division would be allowed, but from assuming that the resulting fractions $\dfrac{5x}x=\dfrac{8x}x$ are of type 3., and so assuming that each should stand for a unique number.
If we don't assume that the resulting fractions are of type 3. (why should we assume such a thing? we don't want to assume anything about $x$, we want to find it!), then there is nothing contradictory about the fact that you get $5=\dfrac{5x}x=\dfrac{8x}x=8$. There is nothing contradictory because all that says is that each of the two fractions stands for two different numbers, and this can only happen if both fractions are of type 1. Hence, both fractions are really just the indeterminate fraction $\dfrac00$, which means that both fractions are really just the indeterminate fraction $\dfrac00$, so we get $x=0$ and $5x=0=8x$.
Again, doing this kind of argument right requires that you are very careful, and for schoolwork you should just check separately what happens in the case when what you are dividing by is $0$ and the case when it is not.
A: You're trying to solve an equation: this means finding one or more x's that make the left-hand side equal to the right-hand side. 
Think of x as some (real) number: x is either zero or non-zero. If you want to divide out x, you'll need to promise that x is not zero. OK, do it:
$5 = 8$
Now ask, "for what values of x (chosen from those x's that are nonzero) is this true?" There aren't any!
Now we don't make this promise:
$5x = 8x.$
Ask: "for what values of x (chosen from those x's that are equal to zero) is this true?" Answer: x = 0 (since $5 \times 0 = 8 \times 0$). 
Put the two cases together, and you've found a single x that solves the equation: x = 0.
A: I believe the algebraic transform you are looking for is:
$$a = b \Rightarrow \left(\frac ax = \frac bx \right) \lor (x = 0)$$
A: First, a small point of terminology: deducing $5=8$ from $5x=8x$ is better described as cancelling rather than dividing by $x$, as this makes sense in domains such as the integers, where division is not always defined.
My advice to students (specifically aimed at first-year undergraduates struggling with things they should have learned at school):
"You surely know that you must never divide by zero.  But even more than this, don't ever divide by anything, or cancel anything, that could possibly be zero."
Basically I agree with WillO, though I think students having trouble with this issue need a firmer discouragement than "not a good policy".
For the context of the above quotation see http://www.maths.unsw.edu.au/currentstudents/revision-worksheets/basic-algebra.pdf.
