How do I solve this equation with 3 constants? (Setting one constant to an arbitrary case value?) $$m+re^{rx}=3x+2(mx+b+e^{rx}) +1 $$
Solution says:
if (r != 0) then m=2b+3; r=0; 0=3+2m  ...and then solves for m, r, and b.
if (r == 0) then m=2b+1; r=0; 0=3+2m  ...and then solves for m, r, and b.
I'm not sure how to follow this.  If r can be anything, how did they force others to become a fixed expression?   Are they matching terms and positions ?
Also, what is this method called ?
How am I supposed to know to force r to be different cases?
 A: Hint: Each side defines a function of $x$. The idea is that the functions are supposed to be equal, which means the equation is supposed to hold for all values of $x$.
You aren't solving for $x$, you're solving for the values of the various coefficients which make the equation true regardless of the value of $x$.
A simpler example would be if you were told $2x-e^{5x} = ax^2 + bx +ce^{rx}$. Then you would conclude that $a=0$, $b=2$, $c=-1$, and $r=5$. You are equating coefficients of similar terms on each side.
Try doing this. Remember, as far as $x$ is concerned, the constant term on the left is $m$ and the constant term on the right is $2b+1$, when $r$ isn't zero. But when $r$ is zero, the whole left side is constant ($m+0$, or $m$) and the constant on the right side is $2b+2+1$ ($=2b+3$). That's because multiplying the variable $x$ by $0$ produces a non-variable result (always zero regardless of the value of $x$, so constant).
A: You have two questions here: 


*

*What's it called when you split into multiple cases like this? 

*How am I supposed to know to do this? 
For the first, I've heard it called "case analysis". 
For the second: Suppose I tell you that the difference of my son's and my daughter's ages is twice my son's age, and my daughter is $12$ (and they're not twins) and ask how old my son is. You might say to yourself "the difference in ages is $s-d$ (where $s$ is the son's age, $d$ the daughter's age). Or maybe it's $d - s$...it depends on which kid is older. Hmmm." 
There are three possibilities: my son is younger than my daughter, or older (they're not twins). So you split your work into two cases. If my son is older, the age difference is $s-d$; otherwise it's $d - s$. And then you go on and do some algebra. 
In the same way, you can look at 
$$m+re^{rx}=3x+2(mx+b+e^{rx}) +1 $$
and perhaps do a little algebra to turn it into
$$
re^{rx}- 2e^{rx}=3x+2mx+2b+ 1 -m $$
and say to yourself "Those $e^x$ terms on the left are a pain. If $r$ was zero, they'd be nice and simple. Hmmm. Let's split into cases. Case 1: $r$ is zero. That'll be easy. Case 2: $r$ is not zero. That'll be harder, but at least it'll delay things a bit."
So for case 1, you say: "Suppose $r = 0$. Then the equation becomes
\begin{align}
-2 &= 3x+2mx+2b+ 1 -m 
0 &= 3x+2mx+2b+ 1 -m + 2
0 &= (3+2m)x+(2b -m + 3)
\end{align}
This is an equality of polynomials: $0x + 0$ on the left, and $(3+2m)x + (2b-m+3)$ on the right, The coefficients must match up, so I have
$3 + 2m = 0$ and $(2b-m + 3) = 0$, and that gets you part 1 of the solution. 
Then for case 2 you say, "OK. Now let's suppose that $r$ is not zero. Then we have
$$
(r-2) e^{rx} = 3x+2mx+2b+ 1 -m = (3 + 2m) x + (2b + 1 - m)
$$
where on the left side we have an exponential function, and on the right side we have a polynomial. The only way these can be equal is if the exponential function is zero, i.e., if $r = 2$. Ah..so now we know that 
$$r = 2$$
and then using the same matching-of-coefficients trick, we see that $3 + 2m = 0$ and $(2b + 1 -m) = 0$. 
And we've matched the second part of the solution. 
