Lesson 1 of 15
S and T Phase Gates
S and T Phase Gates
The S gate (also called the phase gate or ) and T gate () are fundamental single-qubit phase gates.
S Gate
The S gate applies a phase to :
T Gate
The T gate applies a phase to :
Why These Gates Matter
Phase gates do not change measurement probabilities on their own — and are unchanged. Their power lies in interference: applying S or T before a Hadamard creates a different superposition.
The T gate, combined with H and CNOT, forms a universal gate set for quantum computation.
The S² = Z Relationship
Applying S twice gives the Pauli-Z gate:
Implementation
To apply S to a state :
To apply T to a state :
import cmath, math
def s_gate(state):
return [complex(state[0]), state[1] * 1j]
def t_gate(state):
return [complex(state[0]), state[1] * cmath.exp(1j * math.pi / 4)]
Your Task
Implement s_gate(state) and t_gate(state) that apply the S and T gates to a 2-element complex state vector.
Python runtime loading...
Loading...
Click "Run" to execute your code.