drag to move the galaxy behind the lens · scroll, pinch or slider to resize it · dotted grey is the critical curve, dashed grey the caustic · play drifts the source and swaps it every so often
source image: whirlpool galaxy (m51) · NASA, ESA, S. Beckwith (STScI), and the Hubble Heritage Team (STScI/AURA) · CC BY 4.0
the lens
a foreground mass at redshift 0.5, a real hubble galaxy behind it at redshift 2, and one evaluation of the lens equation per pixel. the images are the genuine hubble frames, only ever sampled through the map from where light arrives to where it left. nothing is painted on: the arcs, the einstein ring, the multiple images and the mirror flips all fall out of one equation.
the lens menu has four free models and nine real objects. the real ones load their published einstein radius, shape, shear and distances, rounded from the literature, and the readouts recompute from those: pick the cosmic horseshoe and the mass and velocity dispersion in the corner are its. the point masses go the other way, from a mass and two distances to an einstein radius, which is how a black hole and a single star end up in the same list as a galaxy cluster.
the caustic is the dashed curve. it lives in the source plane, so it marks where the unlensed galaxy would have to sit to be maximally distorted. drag the galaxy across it and watch two new images appear from nothing on the dotted critical curve, then peel apart. the lens galaxy in the middle is a foreground object, so it is drawn unlensed, with the same shape and orientation as the mass.
the physics
the whole thing. a ray that arrives at the telescope from direction θ actually left the source at β, displaced by the deflection α. every pixel on the canvas is a θ; the shader computes its β and looks up the galaxy there. because the equation runs backwards, from image to source, it never has to find the images: any θ whose β lands on the galaxy simply shows it.
einstein's 1915 result, twice the newtonian value, for a ray passing at impact parameter b. the reduced deflection that appears in the lens equation scales it by the ratio of distances between lens, source and observer, which is why the same mass lenses more strongly when it sits roughly halfway to the source.
the one number that sets the scale of everything. a source exactly behind the lens is imaged into a ring of this angular radius; everything else is measured against it. the mass readout inverts this: whatever the model, the mean mass inside the einstein radius is fixed by θE and the distances alone, which is why lensing is the cleanest way there is to weigh a galaxy.
a galaxy is not a point. its stars and dark matter move with roughly constant velocity dispersion σ, which gives a density falling as 1/r² and a deflection of constant magnitude, pointing straight at the centre regardless of distance. the einstein radius then measures σ directly, and that is the velocity dispersion readout in the corner: a typical lens galaxy comes out at 200 to 300 km/s.
inside the einstein radius a source gets two images at β ± θE, one each side of the lens, the inner one flipped. outside it gets one. the caustic has shrunk to a single point at the centre, which is why a round lens makes a full ring only when the alignment is perfect.
flatten the mass and the deflection stops pointing at the centre. kormann, schneider and bartelmann found this closed form in 1994, written here in the frame of the lens with the major axis along x, and it is what the shader evaluates for the ellipsoid and the cluster. the ellipticity slider is 1 − q; as q → 1 both branches collapse to the sphere.
the point caustic opens into an astroid with four cusps. a source inside it has four images, the einstein cross; a source between the astroid and the outer cut has two; beyond that, one. near a cusp two of the four images merge into a single bright arc, which is the configuration most giant arcs in cluster images are.
a real lens is never alone. neighbouring galaxies and the large-scale structure along the line of sight add a tidal stretch that is nearly uniform across the lens, and is the standard extra term in any lens model. here it is aligned with the horizontal axis; even a few percent visibly reshapes the caustic, which is why it is so hard to constrain from images alone.
lensing conserves surface brightness, so an image is never brighter per pixel than the source. what changes is its area, and the jacobian of the lens map says by how much. the convergence κ is the scaled surface density and stretches isotropically; the shear γ stretches along one axis and squeezes the other, which is what turns a round galaxy into an arc. the magnification is the reciprocal of the determinant.
the cursor readout is this local μ. where it is negative the determinant has flipped sign and the image is a mirror image of the source: look for the reversed spiral arms on the inner images. the total magnification in the corner is the lensed flux over the unlensed flux of the whole galaxy, integrated across the frame.
where det A = 0 the magnification is formally infinite. those points form the critical curves in the image plane, dotted, and their images under the lens equation form the caustics in the source plane, dashed. crossing a caustic changes the number of images by two, always: a pair is born together on the critical curve and separates as the source moves further in. the image count is odd for any non-singular lens; the missing central image here is simply demagnified out of existence by the singular core, as it is in real lenses.
the sphere and the point mass each have one circular critical curve, at the einstein radius, and a caustic that has collapsed to a point. the ellipsoid keeps the ring, now slightly deformed, and inflates the point into the astroid. the tangential critical curve is where arcs form: an image that straddles it is stretched enormously along the curve and not at all across it.
the images are not simultaneous. each corresponds to a stationary point of the arrival-time surface, which has a geometric part for the longer path and a gravitational part for the shapiro delay through the potential. for a galaxy-scale lens the difference between images is days to months, and because it scales with the distances it scales with 1/H0: a lensed supernova or quasar that flickers is a measurement of the expansion rate, as refsdal proposed in 1964 and as has now been done.
the readouts assume a flat universe with H0 = 70 km/s/Mpc and Ωm = 0.3. the free models put the lens at redshift 0.5 and the source at redshift 2, with a field of view of 10 arcseconds for the galaxy lenses and 160 for the cluster; the real objects carry their own redshifts, or straight distances for the ones inside the milky way, and a field of view sized to their einstein radius. the angular diameter distances are integrated numerically from those. an einstein radius of 1.75″ then holds about 7 × 1011 solar masses and needs a velocity dispersion near 310 km/s, which is a massive elliptical; the cluster setting reaches 1014. the controls are mirrored into the page url, so a configuration can be linked.
how it's rendered
the fragment shader takes four sub-pixel positions per pixel, converts each to an angle θ, evaluates the deflection analytically and samples the hubble image at β. there is no integrator, no geodesic and no iteration: in the thin-lens limit all of general relativity has been folded into the deflection formula. that makes it cheap enough to run at full resolution with the source dragging live, where the black hole page needs hundreds of integration steps per pixel.
the galaxy images are feathered to black at their edges so the frame boundary does not lens into a visible rectangle. the deep field is tiled with mirrored repeats instead, so the lens can be panned across it forever without a seam.
the critical curves are contours of det A = 0. the page samples the determinant on a grid over the image plane, with the jacobian taken by central differences of the same deflection function, and runs marching squares to extract the zero contour as line segments. pushing each vertex through the lens equation gives the caustic for free. both are drawn on a 2d canvas layered over the webgl one, so they can be toggled without touching the render.
a de vaucouleurs profile with the axis ratio and position angle of the mass, in the yellow of an old stellar population at redshift 0.5, and effective radius set to a fraction of the einstein radius. it is added after lensing because it is in front of the lens, not behind it. in the cluster mode eight smaller members are scattered through the field and each one also deflects, which is what gives the giant arcs their kinks.
a single lens plane: the deep field galaxies are really at every redshift from 0.5 to 10 and would each be lensed differently. no cosmological dimming or colour shift of the source. no microlensing by individual stars in the lens galaxy, which in real systems makes the image fluxes disagree with any smooth model. and the cluster is a smooth ellipsoid plus a handful of members, where a real one has substructure at every scale. the hubble frames are also far more resolved than any lensed galaxy at redshift 2 could ever be, which is precisely what makes the distortion legible.
the thirteen photographs are from the esa/hubble archive, used under CC BY 4.0. most are hubble heritage team images credited to NASA, ESA and STScI/AURA: the whirlpool (heic0506a), ngc 1300 (opo0501a), the pinwheel (heic0602a), bode’s galaxy (heic0710a), messier 106 (heic1302a), the sombrero (opo0328a), the cigar galaxy (heic0604a), the antennae (heic0615a), ngc 2207 (opo9941a) and arp 273 (heic1107a). ngc 1275 (heic0817a) is credited to NASA, ESA and Andy Fabian; stephan’s quintet (heic0910i) to NASA, ESA and the hubble SM4 ERO team; and the 2014 ultra deep field (heic1411a) to NASA, ESA, H. Teplitz and M. Rafelski (IPAC/Caltech), A. Koekemoer (STScI), R. Windhorst (Arizona State University) and Z. Levay (STScI). the star is a procedural limb-darkened disc, there because a galaxy behind a single star makes no physical sense. the full credit line for whichever image is loaded sits under the canvas.