# How to solve the matrix K ^ -1 * F where the terms have unknowns?

11 views (last 30 days)
Elizabeth Valente on 9 Jul 2020
Answered: John D'Errico on 22 Jul 2020 at 10:09
K = [14.8482*a+14.8492*c,-14.8482*a+14.8492*c;-14.8482*a+14.8492*c,14.8482*a+42*b+14.8492*c]
F = [34.641;-0.027754*a-0.019625*b-0.027754*c+20]
I have the following matrices:
K => 2 x 2
F=> 2 x 1
I need to know how to do the multiplication K ^ -1 * F according to my variables a, b, and c.

madhan ravi on 9 Jul 2020
doc mldivide
John D'Errico on 9 Jul 2020
Please don't put the actual equations into the tags field. Numbers are not tags.

KSSV on 9 Jul 2020
syms a b c
K =[14.8482*a+14.8492*c,-14.8482*a+14.8492*c;
-14.8482*a+14.8492*c,14.8482*a+42*b+14.8492*c];
F= [34.641;
-0.027754*a-0.019625*b-0.027754*c+20];
s = 1/K*F

John D'Errico on 22 Jul 2020 at 10:09
If K is a 2x2 matrix, parameterized by a,b,c, F is a 2x1 vector, then do exactly what you want.
syms a b c
K = [14.8482*a+14.8492*c,-14.8482*a+14.8492*c;-14.8482*a+14.8492*c,14.8482*a+42*b+14.8492*c];
F = [34.641;-0.027754*a-0.019625*b-0.027754*c+20];
inv(K)*F
ans =
(57735*(74241*a + 210000*b + 74246*c))/(8*(649608750*a*b + 918682881*a*c + 649652500*b*c)) - (625*(74241*a - 74246*c)*((499971616232163*a)/18014398509481984 + (157*b)/8000 + (499971616232163*c)/18014398509481984 - 20))/(3*(649608750*a*b + 918682881*a*c + 649652500*b*c))
(57735*(74241*a - 74246*c))/(8*(649608750*a*b + 918682881*a*c + 649652500*b*c)) - (625*(74241*a + 74246*c)*((499971616232163*a)/18014398509481984 + (157*b)/8000 + (499971616232163*c)/18014398509481984 - 20))/(3*(649608750*a*b + 918682881*a*c + 649652500*b*c))
This assumes you want the matrix inverse, the only think that (I think) makes sense in context as written. Alterntively, we could have written it as:
K\F
ans =
(5*(9134656710910914789900288*a + 16380965442632841953280000*b + 2447786755204015747760128*c - 3280826448118202499072*a*b + 312482260145101875*a*c + 3281047405974920364032*b*c - 4639799095086501660375*a^2 + 4640111577346646762250*c^2))/(54043195528445952*(649608750*a*b + 918682881*a*c + 649652500*b*c))
-(5*(2447786755204015747760128*c - 9134656710910914789900288*a + 3280826448118202499072*a*b + 9279910672433148422625*a*c + 3281047405974920364032*b*c + 4639799095086501660375*a^2 + 4640111577346646762250*c^2))/(54043195528445952*(649608750*a*b + 918682881*a*c + 649652500*b*c))
which while it looks different, is the same thing, if we carefully simplified things. You can verify that claim easily enough.
simplify(inv(K)*F - K\F)
ans =
0
0
Finally, this will fail when the matrix K is a singular matrix. That happens charcteristically when det(K) == 0.
det(K)
ans =
(1559061*a*b)/2500 + (2756048643*a*c)/3125000 + (779583*b*c)/1250