Quantum Computing SEArchived Mar 16, 2026✓ Full text saved
What is the need to apply the Hadamard gate as the first step while designing the diffuser circuit in the implementation of Grover's algorithm? I know what the gate does but I cannot understand what specific purpose it serves in this case.
Full text archived locally
✦ AI Summary· Claude Sonnet
Hadamard gate in Grover algorithm
Ask Question
Asked 3 years, 9 months ago
Modified 2 days ago
Viewed 390 times
1
What is the need to apply the Hadamard gate as the first step while designing the diffuser circuit in the implementation of Grover's algorithm? I know what the gate does but I cannot understand what specific purpose it serves in this case.
circuit-constructiongrovers-algorithmhadamard
Share
Improve this question
Follow
edited Jun 2, 2022 at 6:01
Martin Vesely
15.6k4
4 gold badges
34
34 silver badges
76
76 bronze badges
asked Jun 1, 2022 at 19:09
Chanchal Sharma
111
1 bronze badge
Add a comment
3 Answers
Sorted by:
Highest score (default)
Date modified (newest first)
Date created (oldest first)
0
The H gate is used to create an equal superposition of all computational states, each of which represents an item in the search region. Then the following circuits are applied to rotate the vector to the target.
Share
Improve this answer
Follow
answered Jun 2, 2022 at 0:20
刘环宇
893
3 bronze badges
Add a comment
0
The Hadamard gate is used (in most descriptions) as a simplification to generate a superposition of the database.
Say we want to find a marked element in a database
D
𝐷
. The simplification is based on the assumption that the database has a number of entries that's a power of
2
2
. Formally, one would use a operator
U
D
𝑈
𝐷
that generates a superposition of all the elements in the database
D
𝐷
.
For Example: Say the database consists the integers from
{0,1,...,7}
{
0
,
1
,
.
.
.
,
7
}
. Then the Hadamard transform
H
⊗3
𝐻
⊗
3
performs the map
U
D
:|0⟩↦
∑
7
i=0
|i⟩
𝑈
𝐷
:
|
0
⟩
↦
∑
𝑖
=
0
7
|
𝑖
⟩
. Circuit with 0,1, ..., 7
If the database would instead be the integers
{0,1,...,6}
{
0
,
1
,
.
.
.
,
6
}
, then one would use a different operator
U
D
:|0⟩↦
∑
6
i=0
|i⟩
𝑈
𝐷
:
|
0
⟩
↦
∑
𝑖
=
0
6
|
𝑖
⟩
. Circuit with 0,1, ..., 6, where
U
D
𝑈
𝐷
is called "{0,...,6}".
(You can verify that the operators generate the databases by looking at the probability distribution after the operator)
Share
Improve this answer
Follow
edited Jun 3, 2022 at 9:10
answered Jun 3, 2022 at 9:04
Fleeep
3741
1 silver badge
5
5 bronze badges
Add a comment
0
In our Grover’s algorithm, we:
Add the initial Hadamard gates ie put our circuit in equal superposition |s>
Apply the oracle
Apply reflection about |s>
For the reflection (diffuser), we need to implement U = 2|s><s| - 1 As we want to add negative phase to every state orthogonal to |s>, we implement as follows:
Transform |s> to |0> by applying Hadamard gates (this is why we use it!) Apply a circuit to add negative phase to states orthogonal to |0> Transform |0> back to |s> using Hadamard gates
Without the Hadamards, we cannot add the negative phase to states orthogonal to |0> as it needs to be converted first.
This link may help: https://qiskit.org/textbook/ch-algorithms/grover.html#2.-Example:-2-Qubits-
Share
Improve this answer
Follow
answered Jun 29, 2022 at 13:23
Shraddha
262
2 bronze badges
Add a comment
Your Answer
Post Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
circuit-constructiongrovers-algorithmhadamard
See similar questions with these tags.
The Overflow Blog
Open source for awkward robots
Domain expertise still wanted: the latest trends in AI-assisted knowledge for...
Featured on Meta
Logo updates to Stack Overflow's visual identity
Related
3
Analysis of the second Hadamard in the Detusch-Jozsa Algorithm
2
Hadamard/Phase/Hadamard and Inversion about the Mean
4
How Grover's algorithm retrieves a value from an unsorted list in
O(
N
−
−
√
)
𝑂
(
𝑁
)
steps, if the iterator is consisted of more than
O(1)
𝑂
(
1
)
steps?
0
Is there a polynomial time mapping from 'Grover States' to an orthonormal set of vectors
1
Complexity of pixel detection in quantum images
2
Understanding the diffusion operator in Grover's algorithm
1
How is Grover's algorithm faster than an apples-to-apples classical version?
Hot Network Questions
Definition of n-huge cardinals in Harvey Friedman's works
How can I remove the handle from my faucet?
How random is RandomInteger[{0,B}]?
Typical length and structure of “selection criteria responses” in Australian academic job applications (math/statistics)
Authorship in Mathematics
more hot questions
Question feed
By continuing to use this website, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. By exiting this window, default cookies will be accepted. To reject cookies, select an option from below.
Customize settings
Cookie Consent Preference Center
When you visit any of our websites, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences, or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and manage your preferences. Please note, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Cookie Policy
Accept all cookies
Manage Consent Preferences
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
Targeting Cookies
Targeting Cookies
These cookies are used to make advertising messages more relevant to you and may be set through our site by us or by our advertising partners. They may be used to build a profile of your interests and show you relevant advertising on our site or on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device.
Performance Cookies
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
Functional Cookies
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
Cookie List
Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label
Necessary cookies only Confirm My Choices