# Matlab - Equality between 2 Fisher matrices constructed in a different way

I want to know if, on a Fisher matrix, the projection operation (with a Jacobian matrix) commutes with a matricial inversion operation.

The 2 ways to build these 2 matrices are:

1) First method:

1.1) I have an initial Fisher matrix F_ij of size 3x3. I apply a projection on this matrix with a Jacobian J_ij of size 3x3, according to the formula:

1.2) I thus have a new matrix of Fisher 3x3 "M_1" which one qualifies as "projected", that is to say that the old parameters were replaced by new parameters (resulting from the Jacobian)

2) Second method:

2.1) I directly invert the initial 3x3 Fisher matrix and thus I obtain a 3x3 covariance matrix. I then make a projection on this covariance matrix.

2.2) I re-reverse to get a new 3x3 Fisher matrix "M_2"

The goal is to know if in the 2 methods, if the 2 matrices "M_1" and "M_2" are equal.

that thus amounts to knowing if the operation of projection and the inversion of matrix commute.

It should also be specified that my initial Fisher matrix is ​​symmetric and is composed of block sub-matrices (not necessarily square).

I looked for my side and I may have a track with the complement of Schur complement: but I can not conclude.

If someone could prove that there is no equality between the 2 matrices "M_1" and "M_2", under what conditions on the Jacobian could I have an equality between both matrices ?

Below is a symbolic calculus Matlab script where I try to conclude, maybe it will help someone.

clear;
clc;

% Big_1 Fisher :
FISH_Big_1_SYM = sym('sp_', [3,3], 'real');
% Force symmetry for Big_1
FISH_Big_1_SYM = tril(FISH_Big_1_SYM.') + triu(FISH_Big_1_SYM,1);

% Big_2 Fisher :
FISH_Big_2_SYM = sym('sp_', [3,3], 'real');
% Force symmetry for Big_2
FISH_Big_2_SYM = tril(FISH_Big_2_SYM.') + triu(FISH_Big_2_SYM,1);

% Jacobian 1
J_1_SYM = sym('j_', [3,3], 'real');
% Jacobian 2
J_2_SYM = sym('j_', [3,3], 'real');

%%%%%%%% Method 1 : projection before %%%%%%%%%

% Projection
FISH_proj_1_SYM = J_1_SYM'*FISH_Big_1_SYM*J_1_SYM;

%%%%%%%% Method 2 : projection after %%%%%%%%%
% Invert Fisher_2
COV_Big_2_SYM = inv(FISH_Big_2_SYM);
% Projection
COV_proj_2_SYM = J_2_SYM'*COV_Big_2_SYM*J_2_SYM;
FISH_proj_2_SYM = inv(COV_proj_2_SYM);

% Test equality between 2 matrices
isequal(FISH_proj_1_SYM,FISH_proj_2_SYM)


UPDATE :

The execution gives me in a very short time what I suspected: the 2 matrices are not equal.

For example, if I compare the elements (1,1) of the 2 matrices:

>> FISH_proj_1_SYM(1,1)

ans =

j_1_1*(j_1_1*sp_1_1 + j_2_1*sp_1_2 + j_3_1*sp_1_3) + j_2_1*(j_1_1*sp_1_2 + j_2_1*sp_2_2 + j_3_1*sp_2_3) + j_3_1*(j_1_1*sp_1_3 + j_2_1*sp_2_3 + j_3_1*sp_3_3)


and

>> FISH_proj_2_SYM(1,1)

ans =

(sp_3_3*j_1_2^2*j_2_3^2 - 2*sp_2_3*j_1_2^2*j_2_3*j_3_3 + sp_2_2*j_1_2^2*j_3_3^2 - 2*sp_3_3*j_1_2*j_1_3*j_2_2*j_2_3 + 2*sp_2_3*j_1_2*j_1_3*j_2_2*j_3_3 + 2*sp_2_3*j_1_2*j_1_3*j_2_3*j_3_2 - 2*sp_2_2*j_1_2*j_1_3*j_3_2*j_3_3 + 2*sp_1_3*j_1_2*j_2_2*j_2_3*j_3_3 - 2*sp_1_2*j_1_2*j_2_2*j_3_3^2 - 2*sp_1_3*j_1_2*j_2_3^2*j_3_2 + 2*sp_1_2*j_1_2*j_2_3*j_3_2*j_3_3 + sp_3_3*j_1_3^2*j_2_2^2 - 2*sp_2_3*j_1_3^2*j_2_2*j_3_2 + sp_2_2*j_1_3^2*j_3_2^2 - 2*sp_1_3*j_1_3*j_2_2^2*j_3_3 + 2*sp_1_3*j_1_3*j_2_2*j_2_3*j_3_2 + 2*sp_1_2*j_1_3*j_2_2*j_3_2*j_3_3 - 2*sp_1_2*j_1_3*j_2_3*j_3_2^2 + sp_1_1*j_2_2^2*j_3_3^2 - 2*sp_1_1*j_2_2*j_2_3*j_3_2*j_3_3 + sp_1_1*j_2_3^2*j_3_2^2)/(j_1_1^2*j_2_2^2*j_3_3^2 - 2*j_1_1^2*j_2_2*j_2_3*j_3_2*j_3_3 + j_1_1^2*j_2_3^2*j_3_2^2 - 2*j_1_1*j_1_2*j_2_1*j_2_2*j_3_3^2 + 2*j_1_1*j_1_2*j_2_1*j_2_3*j_3_2*j_3_3 + 2*j_1_1*j_1_2*j_2_2*j_2_3*j_3_1*j_3_3 - 2*j_1_1*j_1_2*j_2_3^2*j_3_1*j_3_2 + 2*j_1_1*j_1_3*j_2_1*j_2_2*j_3_2*j_3_3 - 2*j_1_1*j_1_3*j_2_1*j_2_3*j_3_2^2 - 2*j_1_1*j_1_3*j_2_2^2*j_3_1*j_3_3 + 2*j_1_1*j_1_3*j_2_2*j_2_3*j_3_1*j_3_2 + j_1_2^2*j_2_1^2*j_3_3^2 - 2*j_1_2^2*j_2_1*j_2_3*j_3_1*j_3_3 + j_1_2^2*j_2_3^2*j_3_1^2 - 2*j_1_2*j_1_3*j_2_1^2*j_3_2*j_3_3 + 2*j_1_2*j_1_3*j_2_1*j_2_2*j_3_1*j_3_3 + 2*j_1_2*j_1_3*j_2_1*j_2_3*j_3_1*j_3_2 - 2*j_1_2*j_1_3*j_2_2*j_2_3*j_3_1^2 + j_1_3^2*j_2_1^2*j_3_2^2 - 2*j_1_3^2*j_2_1*j_2_2*j_3_1*j_3_2 + j_1_3^2*j_2_2^2*j_3_1^2)


You can see the difference between these 2 elements.

Now, I must therefore find the conditions on the Jacobian so that the 2 Fisher matrices are equal. I am thinking in particular of the many null terms in my Jacobian:

actually I have a Jacobian (3x3) looking like this type of matrix:

Jacobian =

h 2*h*Omega1 0
0 h 2*h*Omega2
0 0 1


with h, Omega1 and Omega2 parameters to estimate. As you can see, there are quite a few null terms.

What would be the way to find from the above code the terms which should be zero on the Jacobian to have equality between the 2 matrices? : Must we have a tridiagonal Jacobian, Must we have matrix blocks in Jacobian ? I don't know for the moment.

ps: I simpilifé with 3x3 matrices but in reality the matrices are bigger: I had to take a simple example to illustrate my problem.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6395157,"math_prob":0.9926222,"size":4830,"snap":"2021-31-2021-39","text_gpt3_token_len":2210,"char_repetition_ratio":0.21798591,"word_repetition_ratio":0.015432099,"special_character_ratio":0.47204968,"punctuation_ratio":0.0914037,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99281293,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-07-23T15:39:51Z\",\"WARC-Record-ID\":\"<urn:uuid:c53445b5-69fd-46fd-b5ea-dcacafeb1496>\",\"Content-Length\":\"161642\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:43a002d5-5c8a-4322-81bc-fd78af68f2c8>\",\"WARC-Concurrent-To\":\"<urn:uuid:7c3ede9e-f3df-475f-aed7-55a3f10f86bf>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://scicomp.stackexchange.com/questions/37782/matlab-equality-between-2-fisher-matrices-constructed-in-a-different-way\",\"WARC-Payload-Digest\":\"sha1:ICJGEKCAASEYNQYVRZSVXJPYOJIQMOQI\",\"WARC-Block-Digest\":\"sha1:MZUIGNOIJ5PCEYLRQOVWTVFQ5DKTSR3N\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-31/CC-MAIN-2021-31_segments_1627046149929.88_warc_CC-MAIN-20210723143921-20210723173921-00279.warc.gz\"}"}