# Finding a relationship between density matrices: Solve error

**URL:** <https://community.wolfram.com/t/finding-a-relationship-between-density-matrices-solve-error/19734>\
**Category:** Questions\
**Tags:** algebra, equation-solving, modeling, symbolic-computations\
**Created:** [March 9, 2022, 4:56am UTC](https://community.wolfram.com/t/finding-a-relationship-between-density-matrices-solve-error/19734 "2022-03-09T04:56:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gustun](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@gustun](https://community.wolfram.com/u/gustun)\
**Post date:** [March 9, 2022, 4:56am UTC](https://community.wolfram.com/t/finding-a-relationship-between-density-matrices-solve-error/19734/1 "2022-03-09T04:56:14Z")

</div>

I am writing my equation according to scenario 1 and scenario 2 and then I am trying to find a relationship between _rho\_f2_ and _rho\_f_ (or rho\_M and rho\_m1m2)

 ![2848scenario.png](https://global.discourse-cdn.com/wolfram/original/2X/9/996fd0f0049d2874be922e3b8f48616bedfde2da.png)

Now, according to scenario 1, m1 and 2 are matrices which have the dimension 2\*2  
From scenario 1, I first write the rho\_ m2 and I put rho\_ m2 in the rho\_f and I got this result :

```
rho_f1={{p_x*(p_h*rho00 + 2.0*p_h*rho11 + rho00*(1 - p_h)) + 
p_x*(2.0*p_h*rho00 + 1.0*p_h*rho11 + 1.0*rho11*(1 - p_h)) + 
p_x*(2.0*p_h*rho00 + p_h*rho11 + rho11*(1 - p_h)) + (1 - 
p_x)*(p_h*rho00 + 2.0*p_h*rho11 + rho00*(1 - p_h)), 
p_x*(p_h*rho01 - rho01*(1 - p_h)) + 
p_x*(-p_h*rho10 + rho10*(1 - p_h)) + 
p_x*(1.0*p_h*rho10 - 1.0*rho10*(1 - p_h)) + (1 - p_x)*(-p_h*rho01 +
rho01*(1 - p_h))}, {p_x*(-p_h*rho01 + rho01*(1 - p_h)) + 
p_x*(1.0*p_h*rho01 - 1.0*rho01*(1 - p_h)) + 
p_x*(p_h*rho10 - rho10*(1 - p_h)) + (1 - p_x)*(-p_h*rho10 + 
rho10*(1 - p_h)), 
p_x*(p_h*rho00 + 2.0*p_h*rho11 + rho00*(1 - p_h)) + 
p_x*(1.0*p_h*rho00 + 2.0*p_h*rho11 + 1.0*rho00*(1 - p_h)) + 
p_x*(2.0*p_h*rho00 + p_h*rho11 + rho11*(1 - p_h)) + (1 - 
p_x)*(2.0*p_h*rho00 + p_h*rho11 + rho11*(1 - p_h))}}

```

Here p\_ h is a coefficient which comes from equation of rho\_ m2 and p\_ x is another coefficient which comes from equation rho\_f.  
From scenario 2, I have this equation:

```
rho_f2 = {{g00 . p_g + 2 . g11 . p_g + g11 . (1 - p_g), -g01 . p_g + 
    g10 . (1 - p_g)}, {g01 . (1 - p_g) - g10 . p_g, 
   2. g00 . p_g + g00 . (1 - p_g) + g11 . p_g}} 

```

and p\_g is a coeffieicent

Now I want to find a functionality/a relationship between rho and g. I want to write the g matrix in terms of rho matrix.

I tried this code(and all the combination of this code) but I am having errors:

```
Solve[rho_f1 . rho_f2 == {{g00, g01, g10, g11}}, Flatten[rho_f1]]

```

In the output it is written that:

> Solve::ivar: (rho00 (1-(p:Blank[\<\<1\>\>]))+rho00 p\_h+2. rho11 p\_h) (1-p\_x)+(rho11 (1-(p:Blank[\<\<1\>\>]))+2. rho00 p\_h+rho11 p\_h) p\_x+(1. rho11 (1-(p:Blank[\<\<1\>\>]))+2. rho00 p\_h+1. rho11 p\_h) p\_x+(rho00 (1-(p:Blank[\<\<1\>\>]))+rho00 p\_h+2. rho11 p\_h) p\_x is not a valid variable.

P.S I am not even sure the _solve_ function is the right way to do it so if you have any other suggestion, will be glad

---

<div class="post-metadata">

**Author:** ![gustun](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@gustun](https://community.wolfram.com/u/gustun)\
**Post date:** [March 10, 2022, 3:39am UTC](https://community.wolfram.com/t/finding-a-relationship-between-density-matrices-solve-error/19734/2 "2022-03-10T03:39:41Z")

</div>

Ok, the problem has been solved

1. I was confused by Wolfram and Mathematica syntax. I thought they are  
all under wolfram and the syntax should be same. For instance i is  
not a complex i but a variable in Mathematica. SO I changed the i by  
esc ii
2. I was confused by matrix multiplication and multiply a matrix with a coefficient. To multiply a matrix with a coefficient we should use ‘\*’, and for matrix multiplication we should use ‘.’

Thanks.
