You asked a very general question at the end, how to solve a problem with a different number of unknowns than equations, and at the same time, to solve for the difference of two of the unknowns. Depending on if the equations are linear or nonlinear, the answer is of course very different. And it will also depend on if there are fewer equations than unknowns or more equations than unknowns. The point is, your question is far too vague for any good complete answer to be offered, at least in less than could be found in a combination of several courses on linear algebra, nonlinear equations, and mathematics in general.
In the problem you show, there are three linear equations, and three unknowns. That means the problem is trivially solvable for all three unknowns, as long as the system of equations has full rank.(As I said, understanding linear algebra is important here.)
eqn(1) = ((d-e)/1.8)-(e/3.3)-((e-b)/0.68)== 0;
eqn(2) = ((e-b)/0.68) == ((b-9)/4.7)+((b+3)/1.5);
eqn(3) = ((9-d)/1.5) == ((d)/4.7) + ((d-e)/1.8);
[A,rhs] = equationsToMatrix(eqn,[b d e])
The idea is now, we can solve the problem using tools like backslash, but first, it will tell us if the problem is well posed. That is, do we have sufficient information to determine all three constants? Rank will tell us. If the matrix A has full rank, then a unique solution exists for all three constants.
So the matrix A has full rank. It is now simplest to use backslash to solve for the unknowns, but we could also have just used solve. That is:
Or, we could do:
[bsol,dsol,esol] = solve(eqn,[b,d,e])
If you want the results in a floating point forrm instead of fractions, then use VPA or DOUBLE on them.
Finally, what you really wanted was to compute d-e, and you could give a hoot about the value of b. Anything like this will work:
There are of course other things you can do. One nice idea is, since you really want the value of d-e, is to do a transformation of variables. This might make the problem simpler in some cases. For example, I'l create a new variable dminuse, such that
dminuse = d - e
Now, everywhere d appears in the problem, we can replace it by (dminuse + e).
transeqn = subs(eqn,d,dminuse+e)
The result is still a linear system of equations. We can solve it in variety of ways, as we have already seen. Here, I'll use vpasolve, since it gives us floating point results directly.
sol = vpasolve(transeqn,[b,e,dminuse])
So again, dminuse is 3.016....
Now, suppose we change the problem, in a way that makes the solve no longer give a unique answer?
For example, suppose I set up a system as:
Now we have only two equations, but three unknowns. Can we infer the value of d-e now?
eqnhat = subs(eqnhat,d,dminuse + e)
[Ahat,rhshat] = equationsToMatrix(eqnhat,[b e dminuse])
In fact, here we can see from the second of those two equations, that b and e are directly related, but that we do not know the value of either of them.
bhat = solve(eqnhat(2),b)
So, if we knew the value of e, then we can compute b. Now, substitute this into the first equation, and solve for dminuse.
Again, the solution depends on an unknown parameter, and this is as much as we can do. Here, I have arbitrarily chosen e as the unknown parameter.
Different provblems arise if we have more equations than unknowns, but I feel I am already pushing the limits of what an answer can do, turning this into a class on how to solve systems of equations. And of course, if the system was not linear, then all hell breaks loose.