# Solving a linear equation in an abstract vector space

I have five abstract vectors a1,a2,a3,a4 and a5 that yield four other objects through abstract addition

w1 = a1 + a2;
w2 = a2 + a3;
w3 = a3 + a4;
w4 = a4 + a5;


and I want to solve the following equation:

 Solve[a*w1 + b*w2 + c*w3 + d*w4 == a1 + a2 + a3 - a4 - a5, {a, b, c, d}]


Unfortunately, Mathematica gives me the result:

{{d -> -((a (a1 + a2))/(a4 + a5)) - (-a1 - a2 - a3 + a4 + a5)/(
a4 + a5) - ((a2 + a3) b)/(a4 + a5) - ((a3 + a4) c)/(a4 + a5)}}


How can I tell Mathematica that I don't want a1,a2,a3,a4 and a5 in the denominator? In my case these are abstract vectors and thus should not appear in the denominator.

• Solve[Thread[Last[CoefficientArrays[a*w1 + b*w2 + c*w3 + d*w4 == a1 + a2 + a3 - a4 - a5, {a1, a2, a3, a4, a5}]] == 0], {a, b, c, d}] says that there are no solutions. Commented Nov 2, 2015 at 17:39
• Try defining w1 = {w1x, w1y} and likewise for all vectors. Commented Nov 2, 2015 at 18:09
• Solve only handles variables that are integers, reals, or complex. The documentation makes this very clear. To use Solve you will have to convert your equation into a system of linear equations in with a known number of variables -- i.e., a vector space of explicitly specified dimension. Solving in abstract vectors spaces is not supported. Commented Nov 2, 2015 at 22:53

Perhaps SolveAlways is what you want. It shows that there is no linear combination of the w's that yields the particular linear combination of the a's, assuming they're independent:

Block[{w1 = a1 + a2, w2 = a2 + a3, w3 = a3 + a4, w4 = a4 + a5},
SolveAlways[
a*w1 + b*w2 + c*w3 + d*w4 == a1 + a2 + a3 - a4 - a5,
{a1, a2, a3, a4, a5}]
]
(*  {}  *)


But a slight change yields a result:

Block[{w1 = a1 + a2, w2 = a2 + a3, w3 = a3 + a4, w4 = a4 + a5},
SolveAlways[
a*w1 + b*w2 + c*w3 + d*w4 == a1 + a2 + a3 - a4 - 2 a5,
{a1, a2, a3, a4, a5}]
]
(*  {{a -> 1, b -> 0, c -> 1, d -> -2}}  *)


(The w's will span only a 4-dimensional subspace of the 5-dimensional space spanned by the a's.)