# The art behind a quantum circuit

Quantum computing is based on how nature is connected, created and experienced, it is beautiful how we, from a hanging vertical computer at around 15 millikelvins, can mimic the most fundamental principles of the reality. I wanted to give a small artistic and natural turn to represent how the circuits we design in paper and composers can be imagined. Because sometimes we are closer to the old alchemist than to the modern developer.

# The quantum challenge

I work at IBM, and last week we organized the IBM Quantum Challenge, where four problems, with a difficulty from zero to hero, were solved by almost two thousand participants.

The tricky part was the last problem, basically, if you imagine a quantum circuit as a black box with an input and an output, what happens inside can be described by a matrix, in this case, participants only had a HUGE 16x16 matrix with imaginary numbers (it is called unitary), with that they needed to guess the circuit that is inside the black box.

But the challenge was, finding the circuit with less cost, that means with fewer gates. CNOT gates (blue ones) cost is ten, and U3 gates (pink ones) is one. **Luciano Pereira**, Ph.D. in condensed matter, nanoscience and biophysics from the Autonomous University of Madrid, who is part of the IFF-CSIC, was able to solve it achieving the minimum cost of **45**, winning the challenge, sharing that score with very few folks around the world. This was his solution:

The solution to this complex problem was simple and elegant, with only 5 U3 gates and 4 CNOT connections, is almost art, or in fact it is.

# The draft

As a kind of artistic experiment, in my mind I was trying to imagine this circuit physically connected. We, humans, are used to interact with physical things in a 3D environment, not in a 2D schematic, so I grabbed my Remarkable tablet (which btw, I recommend you to own one!) and drew a quick schema.

This was just a quick draft and I thought, hmm.. maybe it makes sense… let's move this to Unity to visualize it with more detail.

# Prototyping in Unity

Unity started as a game engine, but now a lot of companies are using it for simulations or even to run machine learning algorithms. Even I used it for some AI experiments in the past.

I had 4 qubits, so I started drawing the qubit bars from their points in a square. While playing with the circuit, I merged 2 CNOT in their common control qubit, and that gave some elegant structure to the circuit.

I liked what I was seeing, so I wanted to push the design a little bit more, not only graphically, but also in terms of… if there was a physical *steampunk-like* Quantum composer… how should it be?

# Interacting with the circuit

The pink U3 gates rotate the qubit based on the three parameters they have, and… what device allows us to encode positions easily in the real world? Combination padlocks. So I converted the U3 gates into padlocks with an enjoyable clicky mechanism to encode the qubit rotations.

# Beautifying with Unity HDRP

And finally, to add a more artistic and beautiful layer of design to all of this, I moved the Unity project to the new Unity HDRP (High Definition Rendering Pipeline) which use compute shaders to achieve a better realism in realtime, this allows me to add some realistic materials and even rendering a quick video in realtime from Unity.

# Next steps?

As you see Unity is a very quick way to prototype quick things, this took me a Sunday in lockdown, and what started as a twitted 2D circuit, ended as something I would like to have physically sitting on my desktop.

This was just a creative-artistic experiment, but… Can you imagine a kid learning quantum computing by composing something like this naturally, with their own hands, and placing the capsule in a virtual Quantum Computer that runs the circuit in the real one? I can :-)

When that kid grows, will be able to simulate how the matter interacts, just like those alchemists tried during the Middle Ages, but this time, with the right tool, a tool that allows us to understand how we, you and the universe works.