Tutorial

Beginner's Guide to Quantum Circuits

A practical introduction to qubits, gates, measurement, and building your first entangled circuit in Qly.

What is a qubit?

A qubit is the quantum version of a bit. Instead of being strictly 0 or 1, a qubit can be in a superposition of both until it is measured. Measurement collapses the state to a classical 0 or 1 with probabilities determined by the state amplitudes.

Measurement

When you measure a qubit, you sample from its state. Repeating a circuit many times (shots) gives a distribution of outcomes. In Qly, you can configure shots and see histograms to understand behavior.

Key single qubit gates

  • H (Hadamard): creates superposition (|0⟩ → (|0⟩+|1⟩)/√2).
  • X (Pauli X): bit flip (|0⟩ ↔ |1⟩).
  • Z (Pauli Z): phase flip (adds a minus sign to |1⟩).

Two qubit gate

CNOT: flips the target qubit if the control is 1. With superposition on the control, CNOT can generate entanglement.

Build your first entangled pair (Bell state)

  1. Apply H to qubit 0 to make a superposition.
  2. Apply CNOT with control on qubit 0 and target on qubit 1.
  3. Measure both qubits. You should see outcomes 00 and 11 with ~50% each.

Try this now in Qly Compute — see the Bell-state example in the modes guide.

Bloch sphere intuition

Visualize a qubit as a point on a sphere. X, Y, and Z are pi rotations around the respective axes. H maps between computational and diagonal bases, enabling interference.

Running on real hardware

With Qly you can simulate circuits and run them on AWS Braket directly from your account. This lets you compare ideal simulations against real device behavior.

Keep learning