3
$\begingroup$

We have a set of equations as

a x + b y = c z + d w
e x + f y = g z + h w

We wish to have a matrix as below :

enter image description here

How can we reach the m (matrix)

$\endgroup$
2
  • 1
    $\begingroup$ Definig equations in Mathematica you must use == instaed of =! $\endgroup$ Commented Nov 9, 2018 at 10:23
  • 1
    $\begingroup$ First solve for {z,w} and then extract the appropriate coefficient array. In[27]:= solzw = {z, w} /. First[Solve[{a x + b y == c z + d w, e x + f y == g z + h w}, {z, w}]]; Normal[CoefficientArrays[solzw, {x, y}][[2]]] Out[28]= {{(d e)/(d g - c h) - (a h)/(d g - c h), (d f)/( d g - c h) - (b h)/(d g - c h)}, {-((c e)/(d g - c h)) + (a g)/( d g - c h), -((c f)/(d g - c h)) + (b g)/(d g - c h)}} $\endgroup$ Commented Nov 9, 2018 at 15:46

2 Answers 2

3
$\begingroup$

This one helps you

 X = {{x},{y}} ; Z ={{z},{w}};

Consider the equations as

eq1 = a x + b y - c z - d w == 0.0;
eq2 = e x + f y - g z - h w == 0.0;

To find the coefficients of X and Z matrix

In[1]:= am = Normal[CoefficientArrays[{eq1, eq2}, {x, y}]][[2]]

Out[1]= {{a, b}, {e, f}}

In[2]:= bm = Normal[CoefficientArrays[{eq1, eq2}, {z, w}]][[2]]

Out[2]= {{-1. c, -1. d}, {-1. g, -1. h}}

Standard form othe equation will be like

am.X == bm.Z 

{{a x + b y}, {e x + f y}} == {{-1. d w - 1. c z}, {-1. h w - 1. g z}}

to find the equation for your requested form you have to calculate inverse of bm

In[3]:= bmInv = Inverse[bm]

Out[3]:= {{-((1. h)/(-1. d g + 1. c h)), (1. d)/(-1. d g + 1. c h)}, {1. g)/(-1. d g + 1. c h), -((1. c)/(-1. d g + 1. c h))}}

multiply bmInv with am to get matr

mat = MatrixForm[bmInv.am]

lastly you can get the standard form of equation as you expected using below line

mat.X == Z
$\endgroup$
2
$\begingroup$

If you rewrite your euations as a list

eq = {-d w + a x + b y - c z, -h w + e x + f y - g z}


M = D[eq, {{x, y}}]
r = eq /. {x -> 0, y -> 0}

check result

M.{x,y}+r ==eq
(* True*) 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.