How do you solve a matrix equation for an unknown symbolic matrix? I have read the documentation on symbolic matrix calcs, and the documentation of linear algebra / systems of linear equations, but can't work out how to do what I want.

For example given the matrix equation `y = Ax`

, where `y`

and `x`

are column vectors with (say) 2 rows, and A is a 2x2 matrix, I can symbolically solve this equation as follows:

```
A = matrix(SR, 2, 2, [[var('a'),var('b')],[var('c'),var('d')]])
y = vector([var('y1'), var('y2')])
# Solve for x such thay Ax = y:
x = A.solve_right(y)
```

Which will give me an expression for each of the elements of `x`

in terms of `[a, b, c, d]`

and the elements of `y`

.

Question: how to I get an expression for the elements of `A`

(i.e. `[a, b, c, d]`

, for a given (symbolic) `x`

and `y`

. Below is a concrete trivial example where the answer is obviously `[a=1, b=1, c=1, d=-1]`

, but how could I solve for these elements in sagemath?

```
A = matrix(SR, 2, 2, [[var('a'), var('b')],[var('c'), var('d')]])
x = vector(SR, [var('x1'), var('x2')])
y = vector(SR, [x1 + x2, x1-x2])
#solve(A*x == y, A) # <= This doesn't work
#solve(A*x == y, ['a', 'b', 'c', 'd']) # <= Nor does this
```

I think I could probably do it by looping through each row (equation) in the system of equations, and generating a list of equations and then solving those for the unknowns, but was wondering if there's a better way?