Circuit Identities

Controlled Global Phase

Difficulty: Easy ★

e^(i alpha) X and X are physically identical on their own. Once controlled they are not, because the global phase becomes a relative phase between the control's branches. Build the controlled version faithfully.

Objective

controlled_phased_x(alpha) returns a two-qubit circuit (control q0, target q1) that applies e^(i alpha) X to q1 when q0 = 1 and does nothing when q0 = 0.

Constraints

  • Allowed gates: cx, p, rz.

Entry Point

controlled_phased_x

Checks

  • Exports controlled_phased_x(alpha).
  • The unitary matches for three values of alpha.

Your Code

Outputpending

Execution results will appear here.