When light beams become mixed up, can we sort them out again? Some cases are easy. The light from two flashlights on the other side of a room overlaps when it reaches us, but the lens in our eye separates them again as it constructs an image. By turning the flashlights on and off, we could also communicate two independent, spatial channels of information to different detectors at the back of our eyes.

But light is readily scrambled by anything more complicated than clear air. Trying to image through a strong scatterer, such as biological tissue, rapidly becomes impossible with increasing sample thickness. Even in the near-perfect glass fibers of optical communications, the slightest bend in the fiber can mix the light beams.

Mathematically, interference of light waves just involves adding and subtracting numbers (which is a linear process), so we can exploit the matrices of linear algebra. With effort, we can measure the optical system's matrix (*1*) and then calculate the inverse matrix that would mathematically undo the mixing. At least, we can do so in principle. However, we did not know how to implement such a (inverse) matrix as a lossless optical component. We did not even know if we could make an arbitrary linear optical device. Now, however, different mathematical approaches (*2*–*6*), together with modern microfabrication, may offer a solution. The optics may even solve the problem itself, thereby avoiding the need for any calculations (*5*, *6*).

Historically, optical components were simple objects, like lenses and mirrors. Now, the lithography developed for electronics offers more sophisticated possibilities. Silicon photonics (*7*) and other integrated approaches enable highly functional, complex (*8*) waveguide circuits near the top of a plane surface. Subwavelength patterning enables novel, nanophotonic structures, including photonic crystals, waveguides, and resonators. Expanding beyond regular structures offers an even wider variety (*2*–*5*).

We already use lithography to make diffractive optical elements; in such elements, light travels through a thin sheet from one side to the other (or possibly reflects off it). Metasurfaces are extending these possibilities (*9*). By itself, such an approach cannot implement arbitrary linear optics. A fully arbitrary device (*5*) requires that every distinct element or pixel in the output light can be formed from an arbitrary combination of every distinct input pixel, not just by transmission or reflection from the same input pixel.

If the light travels inside the sheet, in waveguides or other complex structures, then light from every input element can possibly interfere to form each output. This multiple scattering makes device design hard, both mathematically speaking and from a fabrication point of view. Modern robust optimization algorithms allow efficient blind global optimization, however. Various compact nanophotonic devices have now been designed (*2*–*4*), for example, efficiently converting one set of input beams (or “modes”) to another set of output beams (*2*, *3*).

Another planar approach uses meshes of interfering waveguides (*5*, *10*) (see the figure). The optical properties of the mesh can be programmed through fine adjustments of the lengths or phase shifts of waveguide links. The mesh settings have been known for one class of matrices (unitary transformations) for some time. Now, we know that an extended form of mesh can implement any matrix, finally proving that any linear optical component is possible in principle (*5*).

A key to this proof is that we can always perform a singular value decomposition (SVD) of such a matrix (*5*). The SVD has a simple physical interpretation: For any linear optical device or scatterer, there is a specific set of input beams or modes that couple, one by one, to a specific set of output beams or modes. These input/output pairs or communications modes (*5*) completely describe the device and give independent optical channels through it. The proof is also the design method, mapping the form of the SVD directly into the optics. This SVD approach has another benefit; it allows a progressive, even self-configuring, algorithm (*5*). We can then progressively train an extended version of the simple device shown in the figure, using the communications modes themselves, with no calculations.

There are still many challenges. We are only at the beginning in being able to fabricate actual optical structures and devices based on the optimization or self-configuring algorithms. The complexity of optical systems we can tackle this way will be limited. Imaging even a moderate number of pixels through a strong scatterer will remain very challenging. Not all the problems of using multiple mode fibers for communications can easily be solved in the optical domain; time delays between channels in long fibers may necessitate electronic information storage and calculations (*11*).

Beyond telecommunications or imaging, there are many other potential applications for bespoke linear optical elements. We need sophisticated optical networks for quantum information processing (*10*) and for sensor and signal processing generally. Linear optical processors could avoid the power dissipation of electronics. Complex optics could secure signals against decoding (*12*). Real-time self-configuration could allow automatic beam coupling, optical power combining, tracking of moving sources, and alignment or stabilization of complex optical systems (*5*). Extensions of these approaches could find the best channels through an optical system (*6*). The combination of micro- and nanofabrication, planar optical technologies, advanced robust optimization algorithms, and new self-configuring networks may both generate the new optical results we want and eliminate the ones we would rather avoid.