# UTCTF 2019 - Airport Security (1750pt)

##
March 10, 2019

crypto
quantum

# Airport Security (1750pt)

`Crypto`

**Description:** nc quantumbomb.live 1337

You have a bomb and will receive a random qubit to query the bomb. You’re allowed to apply any unitary matrix to this query, and it’ll query the bomb in superposition of whether or not it’s a bomb. ‘If the bomb measures |1>, it will explode. If the bomb measures |0>, it does nothing. ’ Nothing is measured if there is no bomb.

gates are inputed as:

`numbers = np.matrix([[complex(numbers[0]), complex(numbers[1])], [ complex(numbers[2]), complex(numbers[3])]])`

# Solution

The first part of this challenge is just understanding the description. It will also help to look up the “Elitzur-Vaidman Bomb” experiment because this challenge is very closely modeled from it.

The program gives us a random query qubit of the form `a|0> + b|1>`

. We are told that there is a bomb that may be real or fake. We have to extract information about whether it is real without actually measuring the state of the bomb directly (because that may cause it to explode).

We have the option to apply a unitary gate to our query qubit and (immediately after) apply the query to the bomb. What this step means is that we first apply a gate to the query bit and obtain a new query bit (still in superposition).

Then, if our bomb is real, it will measure the query bit in the `|0> |1>`

basis (thus collapsing the state into 0 or 1). If the measurement of our query bit is 0, we do not measure the bomb. If the measurement of the query bit is 1, we measure the bomb and if it is real, it explodes. The important take-away here is that if the bomb is fake, no measurement takes place on our query bit and it remains in superposition, otherwise is collapses to the basis `|0> |1>`

.

The technique described by Elitzur and Vaidman is to start with the query bit `|0>`

and repeatedly apply a very small rotation gate. (specifically we will do this `pi/(2x)`

times to change the basis to `|1>`

)

```
[cos(x), -sin(x)]
[sin(x), cos(x)]
```

If the bomb is real, we will repeatedly measure the query bit and it has a very high probabilty of measuring `|0>`

and therefore not actually measuring the bomb.

If the bomb is fake, we never measure the query bit and it is allowed to rotate in superposition until it is near `|1>`

.

Then we can measure the query bit to determine if the bomb was real or fake. (If it was real, we expect to measure `|0>`

with high probability and vice-versa)

There is a slight hiccup in the problem because the query bit is initially a random qubit. Therefore, our first gate needs to normalize this qubit to the `|0>`

ket (so we don’t accidentally measure the bomb).

Given the qubit: `a|0> + b|1>`

, we can normalize it with the gate:

```
[1/a, 0]
[0, 0]
```