# What is the difference between Gate.power() and Gate.repeat()?

Why are the gates a and b in this code not the same?

a = UGate(0,0,0.9*np.pi).power(2)
b = UGate(0,0,0.9*np.pi).repeat(2)


I thought that unitary gates function like matrices and that having them repeated after each other means the same as having them to an exponent.

Turns out the power function is computationally much more expensive and returns very strange results as seen in this decomposed image of the two gates i constructed with this code:

qc = qk.QuantumCircuit(2)
qc.barrier(label="power")
qc.append(a, [0])
qc.barrier(label="repeat")
qc.append(b, [1])
display(qc.decompose().decompose().draw("mpl"))


.

Why is there a y-component to gate a on qubit 0?

The method Gate.repeat() accepts positive integers only. While Gate.power() accepts real values. So, you can use it, for eaxmple, to apply the square root of a unitary:
a = UGate(0,0,0.9*np.pi).power(0.5)

To do that, power() method diagonalizes the gate unitary, raises the diagonal entries to the specified power, then reconstructs the resulting gate.
• Yes. And you can easily check that by getting the matrix representation for each gate using .to_matrix()` and do the multiplication. Mar 2 at 17:03