**1. Reconstructing the intrinsic light profile of the background source, i.e. how the source would look like if it hadn’t been gravitationally lensed;**

**2. Constraining the parameters that describe the mass distribution of the foreground object acting as the lens.**

**Simulated source**

**Simulated lensed source**

**Source reconstruction**

(1)

The problem with this approach is that you need to search a 6D parameter space for the source surface brightness profile alone. The dimension of the parameters space increases to 11 once you also minimise over the lens model parameters. Besides, it is not guarantee that the source can be described by a Sersic profile and/or that the source comprises just one knot of emission. Adding multiple profiles means increasing the parameter space, and, therefore, the risk of degeneracies in the solution.

**treat the background source as an ensemble of (not necessarily square) pixels**

**without making any assumption on the profile of the source**. Each pixel describes the surface brightness of the source at that position and is treated as a free parameter. You might think that this is madness: in fact, the background source may extend over hundreds of pixels. Does that mean that we have to search a parameter space with hundreds of dimensions?? The answer, of course, is no! It turns out that you can find an exact solution to the problem via a single matrix inversion. Let’s see how.

**• Pixellated source: the Semi-Linear Inversion Method**

**square**

**pixels**(0.05″ in size)

**whose values represent the surface brightness counts**. In the IP, the pixels values are described by an array of elements , with , and associated statistical uncertainties , while in the SP the unknown surface brightness counts are represented by the array of elements , with .

(2)

At this point the model image can be compared with the observed image via the *merit function*

(3)

(4)

Note the * linear* dependence of this expression on the parameters. Therefore

**finding the most likely source surface brightness distribution, for a fixed mass model, translates into solving a system of linear equations!**

If we now define the following vectors:

(5)

and the matrix with elements

(6)

then Eq. (4) can be written as

(7)

Therefore the solution for the source surface brightness counts can be found via a simple matrix inversion

(8)

Of course this holds true for a fixed mass model. In general, the solution does not have a linear dependence on the lens model parameters, hence the name * semi-linear inversion method*. The final solution is achieved by sampling the lens parameters space, via e.g. a Monte Carlo Markov Chain (MCMC), and by using Eq. (8) to calculate, at each step, the solution for the source surface brightness and the corresponding value of the merit function, until the minimum of that function is found.

In deriving the solution for the source surface brightness counts I have implicitly assumed that each SP pixel behaved independently from the others. As a consequence, the final solution shows severe discontinuities and pixel-to-pixel variations due to the noise in the image being modelled. The way to overcome this problem is to add a *regularization term* to the merit function as explained below.

**• Regularized solution**

*prior*on the parameters , in the form of a regularization term , which is added to the merit function

(9)

where is a regularization constant, which controls the strength of the regularization and is the regularization matrix, with elements . The regularization term is chosen to have a linear dependence on the parameters in order to preserve the matrix formalism. In fact, it is easy to show that the minimum of the newly defined merit function satisfies the condition

(10)

and, therefore, the solution can still be derived via a matrix inversion

(11)

(12)

where represents here the set of values obtained from Eq. (11) for a given .

**• Solution with adaptive pixel scale**

*gradient*regularization term defined as:

(13)

where are the counts members of the set of Voronoi cells that share at least one vertex with the th pixel.