Sure, I can do that. Here goes:

     Let a = 1 and b = 1.

Therefore a = b, by substitution.

If two numbers are equal, then their squares are equal, too:
     a^2 = b^2. 

Now subtract b^2 from both sides (if an equation is true, then if 
you subtract the same thing from both sides, the result is also 
a true equation) so

     a^2 - b^2 = 0.

Now the lefthand side of the equation is a form known as "the 
difference of two squares" and can be factored into (a-b)*(a+b). 
If you don't believe me, then try multiplying it out carefully, 
and you will see that it's correct. So:

     (a-b)*(a+b) = 0.

Now if you have an equation, you can divide both sides by the same 
thing, right? Let's divide by (a-b), so we get:

     (a-b)*(a+b) / (a-b) = 0/(a-b). 

On the lefthand side, the (a-b)/(a-b) simplifies to 1, right? 
and the righthand side simplifies to 0, right?  So we get:

     1*(a+b) = 0,

and since 1* anything = that same anything, then we have:

     (a+b) = 0. 

But a = 1 and b = 1, so:
     1 + 1 = 0, or 2 = 0.

Now let's divide both sides by 2, and we get:

     1 = 0. 

Then we add 1 to both sides, and we get what your programming 
teacher said, namely:

     1 + 1 = 1. 

In fact, you can prove that 47 = -3 or anything else you want. 
But of course you know that is wrong.

Do you know what I did that was not correct?

Shall I tell you? If you want to work it out for yourself before 
viewing my answer, I will space down a few lines so you can hide my 
response and work it out for yourself.


not yet...

Okay, here's the bad thing I did. You can divide both sides of an 
equation by the same thing ONLY AS LONG AS YOU ARE NOT DIVIDING BY 
ZERO. In fact, you cannot ever divide by zero. When I divided by 
(a-b), that means a somewhat disguised form of 0, since a = b = 1. 
That's where I went wrong. Did you figure that out by yourself, or did 
you need the hint?