MATLAB: How to solve A*X = B*Y

matrixsolve

Hello,
I would like to solve the following equation : A*X = B*Y where A and B are n-by-n known matrices. X and Y are vectors of size n. The first k elements of X and the last n-k elements of Y are known. Does anyone have a clue ?
Thank you very much for your help!

Best Answer

If you partition X into known and unknown parts
X=[x1 ; x2]
and similarly
Y=[y1;y2]
then the equation can be rewritten
A(:,k+1:end)*x2 - B(:,1:n-k-1)*y1= B(:,n+1-k:n)*y2 - A(:,1:k)*x1
The RHS of the above consists of all known quantities and reduces to some known vector b. The LHS can be combined into a single linear system which you can solve using normal methods.
Related Question