# Inverting an image, as a matrix

I am curious about something pretty simple, though I have never heard, read and more sadly seen any example of it. Take any image, represent it as a matrix, invert the matrix (assuming the inverse exists) and represent it as an image again. This in some sense visualizes the process of inverting a matrix. It would be pretty easy to code this, but before doing that I just wanted to ask if anybody has examples at hand or can say anything about this. Thanks!

• Give it a try! You may run into issues where the outputs don’t nicely fit into the valid range of color values for the image space (e.g. negative numbers). So you may need to normalize the inverse in some way to make it a valid image – fiveclubs Feb 4 at 12:23

I tried it on square grayscale images myself (just hoping they would be invertible, which was always the case (not much luck involved here, since invertible matrices lie dense)). I added a few examples so you can judge the inverses yourself. Their precise look of course depends on the particular normalization (I used cv2.normalize and also normalized manually by

as done here (I used this to create the LaTeX expression)).

Moreover, I ran this procedure on all test/cat images from CIFAR-10. You can find the results here. Notice that actually a lot of these 32x32 images were (as a matrix) not invertible.

As was asked for by user fiveclubs, here are the normalized inverses of the normalized inverses. They are nowhere near their originals.

Dolphin inverse of inverse:

Painting inverse of inverse:

Tower inverse of inverse:

• Cool, thanks for sharing! I wonder what the inverse of the normalized inverse images would look like. – fiveclubs Feb 5 at 13:08
• @fiveclubs Added – Mathy Feb 5 at 16:21
• Very interesting, thanks for sharing! – fiveclubs Feb 6 at 17:05