Tomography is the process of reconstructing a density distribution from given integrals over sections of the distribution. In our example, we will work with tomography on black and white images. Suppose $x$ be the vector of $n$ pixel densities, with $x_j$ denoting how white pixel $j$ is. Let $y$ be the vector of $m$ line integrals over the image, with $y_i$ denoting the integral for line $i$. We can define a matrix $A$ to describe the geometry of the lines. Entry $A_{ij}$ describes how much of pixel $j$ is intersected by line $i$. Assuming our measurements of the line integrals are perfect, we have the relationship that

$$y = Ax$$

However, anytime we have measurements, there are usually small errors that occur. Therefore it makes sense to try to minimize

$$\|y - Ax\|_2^2.$$

This is simply an unconstrained least squares problem; something we can readily solve!

In [ ]: