# Square root of 2x2 matrix using basic algebra

May 24, 2017

two minutes.

We want to find some matrix $B$ where $ B = \sqrt{A} $ or, equivalently, $ A = B^2 $. We take

Expand $B$ and equate terms.

```
from sympy import *
init_printing()
A,a,b,c,d,e,f,g,h = symbols('A a b c d a\' b\' c\' d\'')
A = Matrix([[a,b], [c,d]])
B = Matrix([[e,f], [g,h]])
e1 = Eq(A,B**2)
e1
```

```
solve(e1, (a,b,c,d))
```

We can calculate the determinant $A$ and $B^2$ (confirming that $det(B^2) = det(B)^2$)

```
Eq(A.det(), factor((B**2).det()))
```

We can also calculate the trace of $A$ and $B^2$

```
Eq(A.trace(), (B**2).trace())
```

But from the equation for the determinant we know that or so so

Giving 4 solutions. Using these two relations we can calculate the expressions for $a’$,$b’$, $c’$ and $d’$ in terms of $a$, $b$, $c$ and $d$. For example, etc…