# Stuck on Codercise I.7.1

**URL:** https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420
**Category:** Codebook
**Created:** [April 11, 2024, 8:36am UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420 "2024-04-11T08:36:56Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![boyuzhang1218](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/boyuzhang1218/32/2477_2.png) [@boyuzhang1218](https://discuss.pennylane.ai/u/boyuzhang1218)
#### Post date: [April 11, 2024, 8:36am UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420/1 "2024-04-11T08:36:56Z")

</div>

![image](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/a/a435c523e88d47090548038515f838628468c029.png)  
In order to act as the same as a Hadamard gate, I need to produce 1/sqrt(2), so I think theta = np.pi / 2.  
To the phi and omega, I has no idea, so I established equation: RZ(phi)\* RX(np.pi / 2)\* RZ(omega) = H with unknowns phi and omega, and the final result is phi=2 \* np. pi omega=2 \* np. pi, but it is still incorrect. How can I get the correct answer?

---

<div class="post-metadata">

### Author: ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)
#### Post date: [April 12, 2024, 2:48pm UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420/2 "2024-04-12T14:48:40Z")

</div>

Hi @boyuzhang1218, welcome to the PennyLane forum!

You’re on the right path but you’ve got the wrong angle for phi and omega. Notice that if phi and omega are 2\*pi that’s equivalent to zero so it would mean that you wouldn’t be performing any rotation. Maybe that factor of two shouldn’t be multiplying but instead doing something else… I hope this helps!

---

<div class="post-metadata">

### Author: ![boyuzhang1218](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/boyuzhang1218/32/2477_2.png) [@boyuzhang1218](https://discuss.pennylane.ai/u/boyuzhang1218)
#### Post date: [April 15, 2024, 3:55am UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420/3 "2024-04-15T03:55:08Z")

</div>

Thank you for your help!

---

<div class="post-metadata">

### Author: ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)
#### Post date: [April 15, 2024, 9:38pm UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420/4 "2024-04-15T21:38:52Z")

</div>

No problem!

I hope you’re enjoying the Codebook 😀

---

<div class="post-metadata">

### Author: ![LdBeth](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/ldbeth/32/2536_2.png) [@LdBeth](https://discuss.pennylane.ai/u/LdBeth)
#### Post date: [May 7, 2024, 8:22pm UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420/5 "2024-05-07T20:22:53Z")

</div>

I suspect there is a bug in the problem, using the definition,

Rz(\omega)Rx(\theta)Rz(\phi)=\begin{bmatrix} e^{-i\pi(\phi+\omega)/2}\cos(\theta/2)& -ie^{i\pi(\phi-\omega)/2}\sin(\theta/2)\\ -ie^{-i\pi(\phi-\omega)/2}\sin(\theta/2) & e^{i\pi(\phi+\omega)/2}\cos(\theta/2) \end{bmatrix}

There is no real value of x that can make e^{-i\pi x}=1 while e^{i\pi x} = -1 so I think the problem has no solution.

Did I missed something?

Welp I figured I did not understand the phrase “up to a global phase”, it is clear to me now.

---

<div class="post-metadata">

### Author: ![isaacdevlugt](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/isaacdevlugt/32/1159_2.png) [@isaacdevlugt](https://discuss.pennylane.ai/u/isaacdevlugt)
#### Post date: [May 8, 2024, 9:59pm UTC](https://discuss.pennylane.ai/t/stuck-on-codercise-i-7-1/4420/6 "2024-05-08T21:59:50Z")

</div>

Hey @LdBeth! Welcome to the forum 🕶

I’m assuming you answered your question? If so, that’s great! We also really appreciate you trying out the codebook. We’re migrating it over to the pennylane website (pennylane.ai) so that whoever uses it can better store their progress and have a smoother experience with the entire PennyLane ecosystem. Those changes are coming on May 13! Definitely recommend checking it out. You just need to create a PennyLane account 🙂

 ![Screenshot 2024-05-08 at 5.58.24 PM](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/3/3dd5cf5311fdfa519a9fff95e2bcc8cbbb042f3b.png)
