A magic state is a specific quantum state (most commonly the T state |T⟩ = (|0⟩ + e^(iπ/4)|1⟩)/√2) that serves as a consumable resource for implementing non-Clifford gates in fault-tolerant quantum computing. Since the T gate cannot be implemented transversally on most error-correcting codes (the Eastin-Knill theorem forbids transversal implementation of a universal gate set on any code), an alternative approach is needed. Magic state injection provides this alternative by using a pre-prepared magic state and Clifford operations (which can be done transversally) to effectively teleport the T gate onto the logical qubit.

The process works as follows: a magic state is prepared on an ancilla logical qubit, a CNOT gate (Clifford, hence transversal) entangles the ancilla with the target logical qubit, the ancilla is measured, and a conditional Clifford correction is applied based on the measurement result. The net effect is a T gate applied to the target qubit, using only Clifford gates and a magic state as fuel. Each T gate in the algorithm consumes one magic state, making the total magic state consumption equal to the T-count of the circuit.

The challenge is that magic states themselves must be prepared to very high fidelity — if noisy magic states are injected, they introduce errors worse than not using error correction at all. This is why magic state distillation is necessary, and it represents the dominant resource cost of fault-tolerant quantum computation.