Search code examples
matlabmatrixlinear-algebraprojectionmatrix-inverse

Linear Algebra : remove row/line and project with a reduced Jacobian is equivalent to project firstly with a full Jacobian and remove after row/line?


I reformulate a first question that has been badly explained. I can't delete this question since I risk the blocking of my account, so don't blame me or be too rude on this point.

I try to check under which conditions on the Jacobian used to get the equality or the inequality between 2 Fisher matrices (so symmetric matrices).

The goal is too see if the projection (with Jacobian) and marginalisation (inversion of matrix and remove a row/column and reinversion) commute.

Each of these 2 Fisher matrices is computed slightly differently. These 2 matrices are Fisher matrices.

Actually, this is the computation of changing parameters between initial parameters for each row/column and final parameters for the final matrix. That's why in both computations, I am using the Jacobian J formulating the derivatives between initial and final parameters :

The formula is : F_final = J^T F_initial J

The first matrix has size 5x5 and the second one has 4x4 size. They are identical except the 4th row/column.


1) First Method : I inverse the initial Fisher 5x5 matrix (which gives a 5x5 covariance matrix). Then, I "marginalise", that is to say, I remove the 4th row/column of this covariance matrix. Then, I inverse again to get a final Fisher 4x4 matrix.

Finally, I perform a projection with a reduced Jacobian J' of size 4x4 (identical to the 5x5 Jacobian used in Second method but without 4th row/column) with formula : F_final = J'^T F_initial J : so I get at the end a 4x4 matrix


2) Second Method : For the second matrix to build : I am doing directly projection on 5x5 second matrix (which I recall is identical to the 4x4 except but with a supplementary 4th row/column).

I perform this projection with the Jacobian 5x5. Then I get the second projected matrix 5x5. Finally, I inverse this 5x5 to get covariance matrix and I remove the 4th row/column on this 5x5 matrix covariance, and I inverse again to get a 4x4 matrix new projected matrix.


I wonder under which conditions I could have equality between the 2 matrices 4x4. I don't know if my method is correct.

To show you a practical example, I put below a small Matlab script that tries to follow all the reasoning explained above :

clear;
clc;

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

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

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

% Remove 4th row/column
J_2_SYM(4,:) = [];
J_2_SYM(:,4) = [];

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

% Projection
FISH_proj_1 = J_1_SYM'*FISH_Big_1_SYM*J_1_SYM;
% Check size : 5x5
size(FISH_proj_1)
% Invert Fisher_2
COV_Big_1_SYM = inv(FISH_Big_1_SYM);
% Marginalisation
COV_Big_1_SYM(4,:) = [];
COV_Big_1_SYM(:,4) = [];
FISH_Big_1_SYM = inv(COV_Big_1_SYM);


%%%%%%%% Method 2 : projection after marginalisation %%%%%%%%%
% Invert Fisher_2
COV_Big_2_SYM = inv(FISH_Big_2_SYM);
% Remove 4th row/column
COV_Big_2_SYM(4,:) = [];
COV_Big_2_SYM(:,4) = [];
% Re-inverse
FISH_Big_2_SYM_new = inv(COV_Big_2_SYM);
% Projection 2x2
FISH_proj_2 = J_2_SYM'*FISH_Big_2_SYM_new*J_2_SYM;
% Check size : 4x4
size(FISH_proj_2)


% Remove 4th row/column of Fisher matrix method 1
FISH_proj_1(4,:) = [];
FISH_proj_1(:,4) = [];

% Test equality between 2 matrices
isequal(FISH_proj_1,FISH_proj_2)

% Matricial equation to solve
eqn = FISH_proj_1 == FISH_proj_2;

% Solving : sigma_o unknown
[solx, parameters, conditions] = solve(eqn, J_2_SYM, 'ReturnConditions', true);

The problem with this script is even I have small matrices (4x4 or 5x5), the code takes a little bit long runtime but the result is that matrices are different.

Update 1

I gave some feedback from persons. An important point is at this portion of Matlab code :

When I do :

% Remove 4th row/column
J_2_SYM(4,:) = [];
J_2_SYM(:,4) = [];

I don't remove elements line j_5_1, j_5_2, j_5_3 of Jacobian J, these terms won't disappear when I do the projection. On the other side, these terms will remain in the other method, in the sense that I take into account of them.

So is it a lost battle to check the equality between the 2 final matrices?

If yes, which modifications or assumptions could lead to have an equality ? i.e to have both operations do commute.

Update 2

Here is an illustration showing the structure of my initial matrix called also "Big Fisher matrix" :

You can see the 2 symmetric black blocks which represents the cross-correlations between the cosmological parameters and all the others parameters (bias spectro, Pshot, IA and bias photo).

I recall that I perform a projection for the first method on this full matrix.

For the second, I do a projection after having removed a row/line and reinversing it (with a reduced Jacobian, i.e of size 4x4 instead of size 5x5 for this Jacobian).

Matrix structure with matrix blocks


Solution

  • You might get a better answer on a mathematics site, eg math.stackexchange.com, than in a maths tag of a programming site.

    I'm not entirely sure what you are trying to do, but if my interpretation is correct then the answer is no, the matrices are not in general equal.

    The block matrix inversion lemma is useful here. For the case in hand, if we write

    F2 = (F1 x)
         (x' y)
    

    Then

    inv(F2) = ( inv( F1 - x*x'/y)  -inv(F1)*x/z )
              ( -x'*inv(F1)/z      1/z)
    

    where

     z = (y-x'*inv( F1)*x)
    

    Thus if we invert F2, project and invert we get

    G2 = F1 - x*x'/y
    

    which will only be the same as F1 if x is 0