# Propagation error of inverse matrix

**URL:** <https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641>\
**Category:** Newbie\
**Created:** [September 21, 2022, 1:44pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641 "2022-09-21T13:44:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dil](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dil/32/26887_2.png) [@Dil](https://root-forum.cern.ch/u/Dil)\
**Post date:** [September 21, 2022, 1:44pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641/1 "2022-09-21T13:44:50Z")

</div>

Hello Rooters,  
I want to calculate the propagation error of inverse matrix.  
Is there a direct way to do it in root?  
I found an equation related to propagation error of inverse matrix from a document(attcached the document)  
Here is my equation

|\sigma\_{\epsilon^-1}|_{ij}^2= [\epsilon^{-1}]ik^2 \* [\sigma{\epsilon}]_{km}^2 \*[\epsilon^{-1}]\_mi^2  
If this is not clear please see equation 10 in the following pdf.

> **[9909031.pdf](https://arxiv.org/pdf/hep-ex/9909031.pdf)**
>
> 274.86 KB

Could someone please help me to work on the Matrix using root?

How can I code this?

I already have inverse matrix and sigma(error ) matrix.

Thanks  
Dil

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 21, 2022, 2:04pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641/2 "2022-09-21T14:04:23Z")

</div>

May be @moneta has an idea.

---

<div class="post-metadata">

**Author:** ![Dil](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dil/32/26887_2.png) [@Dil](https://root-forum.cern.ch/u/Dil)\
**Post date:** [September 21, 2022, 3:36pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641/3 "2022-09-21T15:36:22Z")

</div>

Thank You @ [couet](https://root-forum.cern.ch/u/couet)

According to the equation I need to get the square of each element.  
I am stuck on how to code this.

Assume I have a matrix called matrix\_GEN. This is 6x6 symmetric matrix.

```auto
TMatrixD matrix_GEN(6,6)

//I took the inverse of this matrix_GEN
TMatrixD matInv_GEN(matrix_GEN);
 matInv_GEN.Invert();

```

Then what I need to do, I need to square each element of this matInv\_GEN matrix.

How can I do this?

Thank You  
Dil

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 21, 2022, 4:10pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641/4 "2022-09-21T16:10:07Z")

</div>

It looks like Invert is in [TMatrixT](https://root.cern/doc/master/classTMatrixT.html#a6c28dfe9607b97dbd5d6bcba253f9f70) and in that case there is the operator [Sqr](https://root.cern/doc/master/classTMatrixTBase.html#a1e6299042e73ec405086f708f5385b9b). Again @moneta can cofirm.

---

<div class="post-metadata">

**Author:** ![Dil](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dil/32/26887_2.png) [@Dil](https://root-forum.cern.ch/u/Dil)\
**Post date:** [September 21, 2022, 4:18pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641/5 "2022-09-21T16:18:40Z")

</div>

Hello,  
Thank you for the suggestion,  
I think I solved this.Please see my following code part.

```auto
cout << "Matrix_GEN" << endl;
                matrixGEN.Print(",matrixGEN");
                
                TMatrixD matInv_GEN(matrixGEN);
                matInv_GEN.Invert();
                cout << "Matrix_GEN_Inverse" << endl;
                matInv_GEN.Print("matInv_GEN");
                
                TMatrixD matInv_GEN_square(6,6);
                
                for(int i_Simu=0; i_Simu < 6; i_Simu++){
                    for(int j_Gen=0; j_Gen < 6; j_Gen++){
                        
                        matInv_GEN_square[i_Simu][j_Gen]=matInv_GEN[i_Simu][j_Gen]* matInv_GEN[i_Simu][j_Gen];
                        
                    }
                }
                cout << "Matrix_GEN_Inverse_Square" << endl;
                matInv_GEN_square.Print();

```

---

<div class="post-metadata">

**Author:** ![Eddy\_Offermann](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eddy_offermann/32/25079_2.png) [@Eddy\_Offermann](https://root-forum.cern.ch/u/Eddy_Offermann)\
**Post date:** [September 22, 2022, 10:00pm UTC](https://root-forum.cern.ch/t/propagation-error-of-inverse-matrix/51641/6 "2022-09-22T22:00:02Z")

</div>

Hi Dil,

I guess this question is a rephrasing of this [post](https://root-forum.cern.ch/t/error-of-inverse-matrix/51582/2).

Now it is clearer what you are looking for 🙂

The error in the elements of the inverse matrix coming from uncertainties in the original matrix. This is an implementation of TMatrix operations following the recipes in the pdf file. It is a very specific choice for errors in the equations and not implemented in ROOT.

best regards, Eddy
