Basic Multiplier on quantum circuit using Blueqat

Yuichiro Minato
May 19 · 3 min read


We just implement using basic adder circuit and toffoli gate on blueqat quantum computer SDK.

What is Blueqat?

Blueqat is an open source library for quantum computer.

How to install Blueqat?

Blueqat is provided as Python (ver 3.6+) library. You can install by pip.

pip install blueqat

The overlayed state has shifted so that 0 and 1 come to q2 in about half probability.

If you have any questions or suggestions, please feel free to contact us by our Slack community. (Join from here)

Multiplier of binary number

First thinking about toffoli gate to multiply binary number.

0*0=0 0*1=0 1*0=0 1*1=1

And just add each place.


Just do it. Let’s try to solve 1*2=?

First convert 2 on binary number as 10

We want to realize 01*10=0010

Let’s try to implement this circuit.

Now we want to realize |a,b,x> => |a,b,a*b> and get x0,x2,x4,x8. c is ancilla bit and z is carry bit.

First toffoli gate on each number

Let’s multiply binary number using toffoli gate.

To looks very bothering…


We have z4 and z8 for carry bit.

Sum all values

Summing these values using cx gate.

It looks wasteful of qubits… but now we just left it.

Blueqat code

This is the blueqat code

We read the number from the last number.


We consumed a lot of qubits… There may be a lot of way to make an efficient circuit than the one we implement this time.

Yuichiro Minato

Written by

MDR, Quantum Computing@Tokyo,