# Find Transformation Matrix for Vectors of Functions, and Restrict Results of Solve Function

I have two vectors v,w which have a rather simple linear transformation A.v=w. My goal is to obtain A.

Take the following example v={foo[a],foo[b]} and w={foo[a]+foo[b],foo[a]-foo[b]}. Now my attempt to find a linear transformation is

Solve[Table[A[i, j], {i, 1, 2}, {j, 1, 2}].v == w,Flatten@Table[A[i, j], {i, 1, 2}, {j, 1, 2}]]


i.e. I multiply v with the 2x2 matrix A in the form of Table[A[i, j], {i, 1, 2}, {j, 1, 2} from the left hand side and solve the equality with w for all entries A[i_,j_].

The result I would hope for, is

{{A[1,1] -> 1, A[1,1] -> 1, A[1,1] -> 1, A[1,1] -> -1}}


{{A[1, 2] -> -((A[1, 1] foo[a])/foo[b]) - (-foo[a] - foo[b])/foo[b], A[2, 2] -> -((A[2, 1] foo[a])/foo[b]) - (-foo[a] + foo[b])/foo[b]}}


which of course is a correct result, but I want my expressions A[i_,j_] to be independent of foo[x_]. My question therefore is:

How do I tell Solve to make the solutions independent of foo[x_]?

I have already tried to define a domain dom in Solve[expr,vars,dom], but e.g. Complexes does not work, even though

In:= MemberQ[Complexes, foo[a]]
Out= False


I expect there to be an easier way to find linear transformations in general, but I would like to have this particular issue solved nevertheless.

In your symbolic case, try

D[w, {v, 1}]


{{1, 1}, {1, -1}}

• Thank you very much! This indeed also works for my more complicated problem. I wouldn't have considered D[] for this.
– Fred
Dec 19, 2018 at 21:26
• Oh, I thought I had to wait a little longer. I planned to do it tomorrow. It's done now.
– Fred
Dec 19, 2018 at 22:37
• No problem. You can do that whenever you like. It was just a little reminder. Dec 19, 2018 at 22:39
• It was only because I remembered stackexchange not allowing me to do it this early, but it worked. So thanks again and good bye :)
– Fred
Dec 19, 2018 at 22:40