# Homography Matrix Correlations

If the homography matrix of Image 1 to Image 2 is given, and another homography matrix for image 2 to image 3 is given, how do I calculate the homography matrix for image 1 to image 3?
PS : I need the homorgraphy matrices to be 3x3 only because I would be working on a large dataset.

Consider three points $A$ in image 1,$B$ in image 2 and $C$ in image 3.$H1$ is the homography matrix from $A$ to $B$ and $H2$ is the homography matrix from $B$ to $C$. Then,

$$B = H1A$$

$$C = H2B$$

Substituting for B from first equation

$$C = H2(H1A)$$

Due to matrix associative property,

$$C = (H2H1)A$$

The homography matrix from $A$ to $C$ is given by $H2H1$.