Conversion of geospatial coordinates to matrix indices

We want to use GDAL’s affine geotransform $(g_0, g_1, g_2, g_3, g_4, g_5)$ to find a raster cell at $(i, j)$ in a matrix that interests with a point at $(x, y)$. Remember $i$ and $j$ are row and column, respectively. According to their document, \begin{align*} x&=g_0+j\times g_1+i\times g_2\text{ and}\\ y&=g_3+j\times g_4+i\times g_5. \end{align*}

Solve this system of equations for $j$, and implement get_xy(gt, ij) that transforms $(i, j)$ to $(x, y)$ and get_ij(gt, xy) that does the inverse transform. You have to pass a geotransform gt to the functions.

Submit your derivation in PDF and functions in FirstLastname_geotransforms.py.