The Z gate changes a sign that matters only when amplitudes later interfere. Exact arithmetic here means exact results for the stated model inputs; measured inputs still carry uncertainty and significant-figure limits.

highlighted = computed this step

The Z gate changes one sign

The Z gate changes the sign of the one amplitude but leaves the zero amplitude alone.

Z[3545]=[3545]Z\begin{bmatrix}\frac{3}{5}\\\frac{4}{5}\end{bmatrix}=\begin{bmatrix}\frac{3}{5}\\-\frac{4}{5}\end{bmatrix}
Z gateThe output sign is computed by the Z gate.state3/5 zero4/5 onestate3/5 zero-4/5 oneZgate

A sign alone is not directly visible here

Squaring removes the sign, so direct measurement probabilities stay 9/25 and 16/25. The sign matters only when a later operation recombines amplitudes.

(45)2=1625(-\frac{4}{5})^{2} = \frac{16}{25}
Z gateThe sign change is a phase relation, not a new bar.state3/5 zero4/5 onestate3/5 zero-4/5 oneZgate

The square is the same before and after

The table isolates the one-amplitude sign. The probability is unchanged; the sign becomes visible only when a later gate recombines amplitudes.

aonePone45162545162500\begin{array}{c|c}a_{\text{one}}&P_{\text{one}}\\\frac{4}{5}&\frac{16}{25}\\\frac{-4}{5}&\frac{16}{25}\\0&0\end{array}
Z gateThe probability bars do not change after the sign flip.state3/5 zero4/5 onestate3/5 zero-4/5 oneZgate