Reader small image

You're reading from  Quantum Computing Algorithms

Product typeBook
Published inSep 2023
PublisherPackt
ISBN-139781804617373
Edition1st Edition
Right arrow
Author (1)
Barry Burd
Barry Burd
author image
Barry Burd

Barry Burd received a master's degree in computer science at Rutgers University and a Ph.D. in mathematics at the University of Illinois. As a teaching assistant in Champaign–Urbana, Illinois, he was elected five times to the university-wide List of Teachers Ranked as Excellent by Their Students. Since 1980, Dr. Burd has been a professor in the department of mathematics and computer science at Drew University in Madison, New Jersey. He has spoken at conferences in the United States, Europe, Australia, and Asia. In 2020, he was honored to be named a Java Champion. Dr. Burd lives in Madison, New Jersey, USA, where he spends most of his waking hours in front of a computer screen.
Read more about Barry Burd

Right arrow

Preface

Several years ago, in the waiting room of a physician’s office, I picked up a copy of the magazine Nature. One of the issue’s articles lit a fire under me and led me to the study of quantum computing. At first, I was perplexed. How can this model of computing be so different from the kind of computing we know and love? Why do these strange circuits yield correct answers to mathematical problems?

Being a teacher, I knew that the best way to learn something was to try explaining it to someone else. So I decided to offer a one-semester course for university students. A typical quantum computing introduction involves programming, physics, and abstract mathematics. I wanted my course to attract students from many disciplines, and frankly, I didn’t want the course to be canceled for lack of enrollment. To make this work, I had to carve out a section of the subject that required a carefully measured amount of background knowledge. I wanted students to perform some calculations. But first and foremost, I wanted them to understand why certain quantum computing algorithms work. What does a particular quantum circuit have to do with the problem that they’re trying to solve?

After several false starts, I landed on a plan to focus on matrix operations. Students learned about matrix multiplication and the tensor product. They programmed quantum computers on IBM’s cloud and performed routine calculations to verify the results. Through in-class explorations, they developed insights into the way quantum computing algorithms work. Best of all, they enjoyed the course.

In 2022, the people at Packt asked me to write a book on a particular topic that didn’t interest me. So, I turned the tables on them and proposed a quantum computing book. They took the bait, and the result is the book that you’re reading right now. To be clear, this isn’t a textbook, nor is it a scholarly volume. It’s not a comprehensive guide of any kind. It’s my humble attempt to describe quantum computing algorithms in some detail using only a modest dose of mathematics.

I summarize my approach to the subject in the following bullets:

  • I introduce matrix operations in Chapter 1. Throughout the book, I use matrices to describe basic ideas about quantum computing. I avoid the abstractions that linear algebra requires.
  • I favor examples with actual numbers over formulas and equations.
  • When in doubt, I show all the steps in each of the calculations. If there’s too much detail for you, just skip over some parts.
  • My most important goal is to help you form intuitions about the way quantum computing algorithms work. I use pictures, analogies, and some silly stories to help you understand why the algorithms do what they do. (Some quantum computing algorithms are quite challenging in this respect, but I try as best I can.)

This approach has some built-in limitations. If you hated math when you went to school and you never want to see a math problem ever again, this book might not be for you. On the flip side, you may have already studied linear algebra with its vector spaces and eigenvalues. If so, you’ll learn less from this book than you would from a more advanced introduction. (Without abstract mathematics, we’re limited in what we can cover.)

But I’ve developed this book’s material during three offerings of an introductory college course. And, with each offering, the results were outstanding. Students learned a lot about quantum computing and recommended the course to their friends. I have three semesters of exams and course evaluations to prove all this! So, I hope you keep reading. If all goes as planned, you’ll find this material to be interesting, enlightening, and maybe even entertaining!

Who this book is for

This book is for anyone interested in new ways to solve problems. You may have read some news articles about quantum computing and want to dig a bit deeper. Or, you may have explored some technical literature and found it to be too dense. You may be thinking about your career choices and want to investigate quantum computing.

To appreciate this book, all you need is some exposure to secondary school algebra and some exposure to computer programming. You should be comfortable learning about scientific concepts.

What this book covers

Introduction to Quantum Computing, provides an overview of quantum computing and defines some important terms.

Chapter 1, New Ways to Think about Bits, shows how matrix operations can be used to describe logic gates in classical computing. This chapter also introduces Jupyter notebooks as an environment for writing and running computer programs.

Chapter 2, What Is a Qubit?, describes superposition – a strange characteristic of quantum entities that’s vastly different from the behavior of classical bits. This chapter also introduces Qiskit – IBM’s quantum computing software development kit.

Chapter 3, Math for Qubits and Quantum Gates, provides a way of using matrices to represent qubits’ states.

Chapter 4, Qubit Conspiracy Theories, introduces entanglement using multi-qubit gates.

Chapter 5, A Fanciful Tale about Cryptography, shows how quantum superposition can be used to ensure secure communication between two parties.

Chapter 6, Quantum Networking and Teleportation, describes a way in which one qubit’s state can be transferred to another qubit. This is an essential element in the transmission of quantum information from one place to another.

Chapter 7, Deutsch’s Algorithm, explains how a quantum computer can use superposition and entanglement to solve a simple problem in one step.

Chapter 8, Grover’s Algorithm, shows how a quantum computer can search through a list without examining each of the list’s elements.

Chapter 9, Shor’s Algorithm, describes the way quantum computers will be able to break some of our commonly used cryptographic schemes.

Chapter 10, Some Other Directions for Quantum Computing, describes some alternative approaches to quantum computing.

Assessments contains answers for questions from all the chapters.

To get the most out of this book

You should be comfortable with basic algebra and should have written some computer code. Advanced knowledge in either of these fields is not necessary. No prior understanding of quantum physics is needed. You should be able to think logically about scientific concepts.

This book’s code examples use a very small part of the Python programming language. If you have rudimentary skills with Java, C/C++, Visual Basic, or any related language, you can understand the book’s examples. If you run into a Python feature you don’t already know about, you can learn about it by searching the web.

Software/hardware covered in the book

System requirements

Python

A modern web browser running on any operating system.

IBM Qiskit

Quantum computers on the IBM cloud

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

You can run each of this book’s examples on a web page in the IBM Quantum Lab. As long as you have a web browser, no other software is required.

But you don’t have to rely on IBM’s website. If you’re willing to follow some setup instructions, you can download Qiskit and run each example on your own computer. Your own laptop can simulate the behavior of a very small quantum computer. In this book, we emphasize the use of IBM’s website for running code, but the local execution alternative is always available.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Quantum-Computing-Algorithms. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “In the second cell, type print(x), and then press Shift+Enter.

A block of code is set as follows:

circ = QuantumCircuit(2, 1)circ.h(1)
circ = get_oracle(circ, function)
circ.measure(0, 0)
display(circ.draw('latex'))

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

device = provider.get_backend('ibmq_qasm_simulator')job = execute(circuit, backend=device, shots=1000)
print(job.job_id())
result = job.result()
counts = result.get_counts(circuit)$

Any command-line input or output is written as follows:

$ mkdir quantum$ cd quantum

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “In Figure 8.30, the alice and bob qubit checks to see whether both Alice and Bob get their wishes.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

Contact the author: You can visit https://quantum.allmycode.com, where Barry Burd (the author) posts additional information as needed. You can even send him an email at quantum@allmycode.com. Your reply won’t come from a bot or a paid assistant. That’s a promise!

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Quantum Computing Algorithms, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere? Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application. 

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781804617373

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Quantum Computing Algorithms
Published in: Sep 2023Publisher: PacktISBN-13: 9781804617373
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Barry Burd

Barry Burd received a master's degree in computer science at Rutgers University and a Ph.D. in mathematics at the University of Illinois. As a teaching assistant in Champaign–Urbana, Illinois, he was elected five times to the university-wide List of Teachers Ranked as Excellent by Their Students. Since 1980, Dr. Burd has been a professor in the department of mathematics and computer science at Drew University in Madison, New Jersey. He has spoken at conferences in the United States, Europe, Australia, and Asia. In 2020, he was honored to be named a Java Champion. Dr. Burd lives in Madison, New Jersey, USA, where he spends most of his waking hours in front of a computer screen.
Read more about Barry Burd