One is the loneliest prime number

You can’t prove 1 is, or is not, prime. You have the freedom to choose whether to include 1 as a prime or not and this choice is either guided by convenience or credulity.

I occasionally get some cruel and bitter criticism from an odd source. I’m putting my response here for two reasons: (1) so I that I can simply refer them to it and not have to repeat myself or engage in the equally impersonal displeasure of internet arguments, and (2) I think there is something interesting to be learned about mathematics, logic, and knowledge more generally.

It all started when I wrote a very controversial book about an extremely taboo topic: mathematics. In my book ABCs of Mathematics, “P is for Prime”. The short, child-friendly description I gave for this was:

A prime number is only divisible by 1 and itself.

I thought I did a pretty good job of reducing the concept and syllables down to a level palatable by a young reader. Oh, boy, was I wrong. Enter: the angriest group of people I have met on the internet.

You see, by the given definition, I had to include 1 as a prime number since, as we should all agree, it is divisible only by 1 and itself.

Big mistake. Because, apparently, it has been drilled into people’s heads that this is a grave error, a misconception that can eventually lead young impressionable minds to a life of crime and possibly even death! It might even end up on a list of banned books!

By a vast majority, people love the book. I am generally happy with the reponse. The baby books I write are not for everyone—I get that. And I do try to take advice from all the feedback I receive on my books. There is always room for improvement. But the intense emotions some people have with the idea of 1 being a prime number is truly perplexing. Here are some examples:

I actually love the book, but there is a big mistake. The number 1 is not a prime number! The book should not be sold like this and needs to be reprinted.

and

1 IS NOT PRIME! How could a supposed math book have an error like this in it? I am disgusted!

Yikes. So what gives? Is 1 prime, or not? The answer is: that’s not a valid question.

Let me explain.

First, let’s look at a typical definition. Compare to, for example, Wikipedia’s entry on prime numbers:

A prime number (or a prime) is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers.

Much more precise—no denying that. It’s grammatically correct, but probably hard to parse. I wanted to avoid negative definitions as much as I could in my books. But that’s beside the point. The reason 1 is not a prime is that the definition of prime itself is contorted to exclude it!

OK, so why is that? Well, the answer is probably not as satisfying as you might like: convenience. By excluding 1 as prime, one can state other theorems more concisely. Take the Fundamental Theorem of Arithmetic, for example:

Every integer greater than 1 either is a prime number itself or can be represented as the product of prime numbers and that, moreover, this representation is unique, up to (except for) the order of the factors.

Now, this statement would not be true if 1 were a prime since, for example, 6 = 2 × 3 but also 6 = 2 × 3 × 1 and also 6 = 2 × 3 × 1 × 1, etc. That is, if 1 were prime, the representation would not be unique and the theorem would be false.

However, if we do chose to include 1 as a prime number, all is not lost. Then the Fundamental Theorem of Arithmetic would still be true if it were stated as:

Every integer is a prime number itself or can be represented as the product of prime numbers and that, moreover, this representation is unique, up to (except for) the order of the factors and the number of 1’s.

Which version do you prefer? In either case, both the definition and theorem treat 1 as a special number. I’d argue that in this context, the number 1 is more of an annoyance that gets in the way of the deeper concept behind the theorem. But in mathematics you must be precise with your language. And so 1 must be dealt with as an awkward special case no matter which way you slice it.

So, is 1 prime, or not? Well, it depends on how you define it. But in the end it doesn’t really matter, so long as you are consistent. And understanding that is a much bigger lesson than memorizing some fact you were told in grade school.

The definition given in ABCs of Mathematics is not wrong” any more than all of the other simplifications and analogies I have made are “wrong”. But, in case you were wondering, the second printing will be modified with the hope that everyone can enjoy the book. Even the angry people on the internet deserve to be happy.

Estimation… with quantum technology… using machine learning… on the blockchain

A snarky academic joke which might actually be interesting (but still a snarky joke).

Abstract

A device verification protocol using quantum technology, machine learning, and blockchain is outlined. The self-learning protocol, SKYNET, uses quantum resources to adaptively come to know itself. The data integrity is guaranteed with blockchain technology using the FelixBlochChain.

Introduction

You may have a problem. Maybe you’re interested in leveraging the new economy to maximize your B2B ROI in the mission-critical logistic sector. Maybe, like some of the administration at an unnamed university, you like to annoy your faculty with bullshit about innovation mindshare in the enterprise market. Or, maybe like me, you’d like to solve the problem of verifying the operation of a physical device. Whatever your problem, you know about the new tech hype: quantum, machine learning, and blockchain. Could one of these solve your problem? Could you really impress your boss by suggesting the use of one of these buzzwords? Yes. Yes, you can.

Here I will solve my problem using all the hype. This is the ultimate evolution of disruptive tech. Synergy of quantum and machine learning is already a hot topic1. But this is all in-the-box. Now maybe you thought I was going outside-the-box to quantum agent-based learning or quantum artificial intelligence—but, no! We go even deeper, looking into the box that was outside the box—the meta-box, as it were. This is where quantum self-learning sits. Self-learning is protocol wherein the quantum device itself comes to learn its own description. The protocol is called Self Knowing Yielding Nearly Extremal Targets (SKYNET). If that was hard to follow, it is depicted below.

hypebox
Inside the box is where the low hanging fruit lies—pip install tensorflow type stuff. Outside the box is true quantum learning, where a “quantum agent” lives. But even further outside-the-meta-box is this work, quantum self-learning—SKYNET.

Blockchain is the technology behind bitcoin2 and many internet scams. The core protocol was quickly realised to be applicable beyond digital currency and has been suggested to solve problems in health, logistics, bananas, and more. Here I introduce FelixBlochChain—a data ledger which stores runs of experimental outcomes (transactions) in blocks. The data chain is an immutable database and can easily be delocalised. As a way to solve the data integrity problem, this could be one of the few legitimate, non-scammy uses of blockchain. So, if you want to give me money for that, consider this the whitepaper.

Problem

 

99probs
Above: the conceptual problem. Below: the problem cast in its purest form using the formalism of quantum mechanics.

The problem is succinctly described above. Naively, it seems we desire a description of an unknown process. A complete description of such a process using traditional means is known as quantum process tomography in the physics community3. However, by applying some higher-order thinking, the envelope can be pushed and a quantum solution can be sought. Quantum process tomography is data-intensive and not scalable afterall.

The solution proposed is shown below. The paradigm shift is a reverse-datafication which breaks through the clutter of the data-overloaded quantum process tomography.

fuckyeahquantum
The proposed quantum-centric approach, called self-learning, wherein the device itself learns to know itself. Whoa. 

It might seem like performing a measurement of \{|\psi\rangle\!\langle \psi|, \mathbb I - |\psi\rangle\!\langle \psi|\} is the correct choice since this would certainly produce a deterministic outcome when V = U. However, there are many other unitaries which would do the same for a fixed choice of |\psi\rangle. One solution is to turn to repeating the experiment many times with a complete set of input states. However, this gets us nearly back to quantum process tomography—killing any advantage that might have been had with our quantum resource.

Solution

quantumintensifies
Schematic of the self-learning protocol, SKYNET. Notice me, Senpai!

This is addressed by drawing inspiration from ancilla-assisted quantum process tomography4. This is depicted above. Now the naive looking measurement, \{|\mathbb I\rangle\!\langle\mathbb I |, \mathbb I - |\mathbb I\rangle\!\langle \mathbb I|\}, is a viable choice as

|\langle\mathbb I |V^\dagger U \otimes \mathbb I |\mathbb I\rangle|^2 = |\langle V | U\rangle|^2,

where |U\rangle = U\otimes \mathbb I |\mathbb I\rangle. This is exactly the entanglement fidelity or channel fidelity5. Now, we have |\langle V | U\rangle| = 1 \Leftrightarrow U = V, and we’re in business.

Though |\langle V | U\rangle| is not accessible directly, it can be approximated with the estimator P(V) = \frac{n}{N}, where N is the number of trials and n is the number of successes. Clearly, \mathbb E[P(V)] = |\langle V | U\rangle|^2.

Thus, we are left with the following optimisation problem:
\min_{V} \mathbb E[P(V)] \label{eq:opt},

subject to V^\dagger V= \mathbb I. This is exactly the type of problem suitable for the gradient-free cousin of stochastic gradient ascent (of deep learning fame), called simultaneous perturbation stochastic approximation6. I’ll skip to the conclusion and give you the protocol. Each epoch consists of two experiments and a update rule:

V_{k+1} = V_{k} + \frac12\alpha_k \beta_k^{-1} (P(V+\beta_k \triangle_k) - P(V-\beta_k \triangle_k))\triangle_k.

Here V_0 is some arbitrary starting unitary (I chose \mathbb I). The gain sequences \alpha_k, \beta_k are chosen as prescribed by Spall6. The main advantage of this protocol is \triangle_k, which is a random direction in unitary-space. Each epoch, a random direction is chosen which guarantees an unbiased estimation of the gradient and avoids all the measurements necessary to estimation the exact gradient. As applied to the estimation of quantum gates, this can be seen as a generalisation of Self-guided quantum tomography7 beyond pure quantum states.

To ensure integrity of the data—to make sure I’m not lying, fudging the data, p-hacking, or post-selecting—a blochchain-based solution is implemented. In analogy with the original bitcoin proposal, each experimental datum is a transaction. After a set number of epochs, a block is added to the datachain. Since this is not implemented in a peer-to-peer network, I have the datachain—called FelixBlochChain—tweet the block hashes at @FelixBlochChain. This provides a timestamp and validation that the data taken was that used to produce the final result.

Results

results
SKYNET finds a description of its own process. Each N is a different number of bits per epoch. The shaded region is the interquartile range over 100 trials using a randomly selected “true” gate. The solid black lines are fits which suggest the expected 1/\sqrt{N} performance.

Speaking of final result, it seems SKYNET works quite well, as shown above. There is still much to do—but now that SKYNET is online, maybe that’s the least of our worries. In any case, go download the source8 and have fun!

Acknowledgements

The author thanks the quantum technology start-up community for inspiring this work. I probably shouldn’t say this was financially supported by ARC DE170100421.


  1. V. Dunjko and H. J. Briegel, Machine learning and artificial intelligence in the quantum domain, arXiv:1709.02779 (2017)
  2. N. Satoshi, Bitcoin: A peer-to-peer electronic cash system, (2008), bitcoin.org. 
  3. I. L. Chuang and M. A. Nielsen, Prescription for experimental determination of the dynamics of a quantum black box, Journal of Modern Optics 44, 2455 (1997)
  4. J. B. Altepeter, D. Branning, E. Jerey, T. C. Wei, P. G. Kwiat, R. T. Thew, J. L. O’Brien, M. A. Nielsen, and A. G. White, Ancilla-assisted quantum process tomography, Phys. Rev. Lett. 90, 193601 (2003)
  5. B. Schumacher, Sending quantum entanglement through noisy channels, arXiv:quant-ph/9604023 (1996)
  6. J. C. Spall, Multivariate stochastic approximation using a simultaneous perturbation gradient approximation, IEEE Transactions on Automatic Control 37, 332 (1992)
  7. C. Ferrie, Self-guided quantum tomography, Physical Review Letters 113, 190404 (2014)
  8. The source code for this work is available at https://gist.github.com/csferrie/1414515793de359744712c07584c6990

David Wolfe doesn’t want you to share these answers debunking quantum avocados

Everyone knows you need to microwave your avocados to release their quantum memory effects.

Recently, I joined Byrne and Wade on Scigasm Podcast to talk about misconceptions of quantum physics. Apparently, people are wrong about quantum physics on the internet! Now, since the vast majority of people don’t listen to Scigasm Podcast [burn emoji], I thought I’d expand a bit on dispelling some of the mysticism surrounding the quantum.

Would it be fair to say quantum physics is a new field in the applied sciences, though it has been around for a while in the theoretical world?

No. That couldn’t be further from the truth. There are two ways to answer this question.

The super pedantic way: all is quantum. And so all technology is based on quantum physics. Electricity is the flow of electrons. Electrons are fundamental quantum particles. However, you could rightfully say that knowledge of quantum physics was not necessary to develop the technology.

In reality, though, all the technology around us today would not exist without understanding quantum physics. Obvious examples are lasers, MRI and atomic clocks. Then there are technologies such as GPS, for example, that rely on the precision timing afforded by atomic clocks. Probably most importantly is the develop of the modern transistor, which required the understanding of semiconductors. Transistors exist, and are necessary, for the probably of electronic devices surrounding you right now.

However, all of that is based on an understanding of bulk quantum properties—lots of quantum systems behaving the same way. You could say this is quantum technology 1.0.

Today, we are developing quantum technology 2.0. This is built on the ability to control individual quantum systems and get them to interact with each other. Different properties emerge with this capability.

Does the human brain operate using properties of the quantum world?

There are two things this could mean. One is legit and other is not. There is a real field of study called quantum biology. This is basically material physics, where the material is biological. People want to know if we need more than classical physics to explain, say, energy transfer in ever more microscopic biochemical interactions.

The other thing is called quantum consciousness, or something equally grandiose. Now, some well-known physicists have written about this. I’ll note that this is usually long after tenure. These are mostly metaphysical musings, at best.

In either case, and this is true for anything scientific, it all depends on what you mean by properties of the quantum world. Of course, everything is quantum—we are all made of fundamental particles. So one has to be clear what is meant by the “true” quantum effects.

Then… there are the crackpots. There the flawed logic is as follows: consciousness is mysterious, quantum is mysterious, therefore consciousness is quantum. This is like saying: dogs have four legs, this chair has four legs, therefore this chair is a dog. It’s a logical fallacy.

Quantum healing is the idea that quantum phenomena are responsible for our health. Can we blame quantum mechanics for cancer? Or can we heal cancer with the power of thought alone?

Sure, you can blame physics for cancer. The universe wants to kill us after all. I mean, on the whole, it is pretty inhospitable to life. We are fighting it back. I guess scientists are like jujitsu masters—we use the universe against itself for our benefit.

But, there is a sense in which diseases are cured by thought. It is the collective thoughts and intentional actions of scientists which cure disease. The thoughts of an individual alone are useless without a community.

Is it true that subatomic particles such as electrons can be in multiple places at once?

If you think of the particles has tiny billiard balls, then no, almost by definition. A thing, that is defined by its singular location, cannot be two places at once. That’s like asking if you can make a square circle. The question doesn’t even make sense.

Metaphors and analogies always have their limitations. It is useful to think this way about particles sometimes. For example, think of a laser. You likely are not going too far astray if you think of the light in a laser as a huge number of little balls flying straight at the speed of light. I mean that is how we draw it for students. But a physicist could quickly drum up a situation under which that picture would lead to wrong conclusions even microscopically.

Does quantum mechanics only apply to the subatomic?

Not quite. If you believe that quantum mechanics applies to fundamental particles and that fundamental particles make up you and me, then quantum mechanics also applies to you and me.

This is mostly true, but building a description of each of my particles and the way they interact using the rules of quantum mechanics would be impossible. Besides, Newtonian mechanics works perfectly fine for large objects and is much simpler. So we don’t use quantum mechanics to describe large objects.

Not yet, anyway. The idea of quantum engineering is to carefully design and build a large arrangement of atoms that behaves in fundamentally new ways. There is nothing in the rules of quantum mechanics that forbids it, just like there was nothing in the rules of Newtonian mechanics that forbade going to the moon. It’s just a hard problem that will take a lot of hard work.

Do quantum computers really assess every possible outcome at once?

No. If it could, it would be able to solve every possible problem instantaneously. In fact, we have found only a few classes of problems that we think a quantum computer could speed up. These are problems that have a mathematical structure that looks similar to quantum mechanics. So, we exploit that similarity to come up with easier solutions. There is nothing magical going on.

Can we use entanglement to send information at speeds faster than the speed of light?

No. Using entanglement to send information faster than light is like a perpetual motion machine. Each proposal looks detailed and intricate. But some non-physical thing is always hidden under the rug.

Could I use tachyons to become The Flash? And if so, where do I get tachyons?

This is described in my books. Go buy them.

Nature vs. Technology

The picture of the world presented in children’s books today is a baby boomer’s fairy tale.

This quote from a recent NPR article about Physics for Babies has been cited several times.

When reading to his kids, Ferrie noticed that most books used animals to introduce new words. In today’s world, that just didn’t make sense to him. “We’re not surrounded by animals anymore,” says Ferrie, a physicist and mathematician at a university in Sydney, Australia. “We’re surrounded by technology.” So he created some math and science books for his own children and self-published them online.

Recently, I received a question about it:

I disagree on many levels having grown up in a neighborhood of kids who played in the creek, woods, underground camps, and treehouses that nature can ever not make sense. It seems possible you aren’t listening closely enough. Technology may surround us but nature surrounds technology…you just have to look past the technology to see it. Would love to hear more of your thought on nature and it’s place in your and your children’s lives.

This was my reply:

Thank you for your message. I tend to agree with you. Of course, by taking a sufficiently broad definition of nature, then technology itself is nature. Computers are built from materials which are made of naturally occurring substances which are made of fundamental particles. All is nature on some level.

When talking to reporters, I usually speak for about 30-45 minutes. But what gets printed is one cherry-picked sentence. I can only hope I didn’t say anything that sounds terrible out of context.

But in this case I do stand by the above quote about animals, which was referring to the pets, farm, and zoo animals we see all too often in children’s books. Now, whether you are an animal rights activist or not, the trend is clear: farms are becoming invisible to the public, zoos are removing animals or closing, laws about pet ownership are changing, etc. That is, cruelty is becoming more recognizable to the public and will either end (by social or legal pressure) or become more concealed.

The picture of the world presented in children’s books today is a baby boomer’s fairy tale. Creeks and treehouses and sneaking on to Ol’ Man Bill’s field and late summer baseball games and a meadow full of fireflies at dusk—an eternal summer. That is, if it weren’t for [insert Gen X, Y, or Z]. These books are drugs for a generation drunk on nostalgia and reference material for traditionalism.

It is an oxymoronic picture of a world manufactured for a false sense of exploration. For example, it shows us that we should be fascinated by wild animals (lions, tigers, giraffes, etc.) that coincidentally debuted in safari zoos to sate the boredom of that same generation.

But there is a infinite world out there to explore. It’s just that new tools are required to embark on that journey. These are the tools of science and technology. So, yes, not only does nature plays an unavoidable role in my children’s lives, it is the very motivation to give them the tools necessary to discover more of it on their own.

Am I wrong?

In today’s culture, all you have to do is not be an asshole to be a hero.

We now absolve ourselves by simply denying guilt. Even the hint of criticism is charged as an offense. This fear of shame has run so rampant that a false feeling of innocence has turned into outright narcissism.

You are not a good person. I am not a good person. Let’s admit our faults, make amends, and try to be better.

Story time.

Two of my children are in an art class together. It’s not going well. The teacher does not have much control over the class and favours the returning and skilled students. My two children tend to stick together (good on them), but often get to acting up. Today was particularly bad. The director of the art school had to speak to us about it after class. Their tone was serious, but also apologetic. The report ended with a complement about the children’s art.

At home we reflected on this a bit and decided to call the school. We told them that we were extremely sorry about the disruption and requested the children be split up into different classes and if that was not possible, we would voluntarily remove them from the class. The director was flabbergasted. We were apparently the first parents not to get immediately defensive about their children’s bad behaviour.

They are so afraid of defensive parents that the facts cannot even be stated without being padded with multiple compliments. We were thanked several times and given a free class in addition to accommodation of our request.

The moral of the story: in today’s culture, all you have to do is not be an asshole to be a hero.

No one is going to take you seriously

I make jokes. I do scientist. I make jokes while doing science.

Recently, at the Australian Institute of Physics Congress I presented this poster:

I think it was generally well received. Of course it got lots of double takes and laughs, but was it a good scientific poster? One of my senior colleagues was of mixed minds, eventually concluding with some familiar life advice:

Yes, I admit it is funny. But, eventually it will catch up with you. No one is going to take you seriously. You will not be seen as a serious scientist.

Good—because I am not a serious scientist. I am a (hopefully) humorous scientist, but a scientist nonetheless.

I’m going to get straight to the point with my own advice: avoid serious scientists at all costs. They are either psychopaths or sycophants. I can’t find it in me to be either. So I’ll continue doing science, and having a bit of fun while I’m at it. You only science once, right?

 

How quantum mechanics turned me into a Bayesian

A few elder-statesmen of quantum theory gathered together while a handful of students listened in eagerly. Paraphrasing, one of them—quite seriously—said, “I don’t think any of the interpretations are logically consistent… but there is this ‘transactional interpretation’, where influences come from the future, that might be the only consistent one.” The students nodded their heads in agreement—I walked away.

Bayesianism is (some would say) a radical alternative philosophy and practice for both understanding probability and performing statistical analysis. So, like all young contrarian students of science, I was intrigued when I first found Bayesian probability. But where is the fun in blaming this on my own faults? I’m going to blame someone else—I’m going to blame it on Chris Fuchs.

On two occasions the Perimeter Institute for Theoretical Physics (PI) hosted lectures on the Foundations of Quantum Mechanics. I was lucky enough to be a graduate student in Waterloo at the time. The first, in 2007, was my first taste of the field. It was exciting to hear the experts at the forefront speaking about deep implications for physics andindeed—even the philosophy of science itself. I knew then that this was the area I wanted to work in.

However, I quickly became disillusioned. The literature was plagued by lazy physicists posing as armchair philosophers. There was no interest in real problems—only the pandering of borderline pseudoscience. It’s no wonder—why bother doing hard work and difficult mathematics when peddling quantum mysticism is what gets you press?

I stayed, though, because there were several researchers at PI who seemed interested in solving real, technical problemsand, they were doing so using techniques from another field I had already worked in: Quantum Information Theory. I learned an immense amount from Robin Blume-Kohout, Rob Spekkens and Lucien Hardy while there, but the one who left a lasting impression was Chris Fuchs.

Before we get to Fuchs, though, let’s back up for a momentjust what is this Quantum Foundations thing, and what has it got to do with Bayesianism? As you know, quantum theory dictates that the world is uncertain. That is, as a scientific theory, it makes only probabilistic predictions. Many of the philosophical problems and misunderstandings of quantum theory can be traced back to this fact. Thus, if one really wants to understand quantum theory, one ought to understand probability first. Easy, right?

Nope. As it turns out, more people argue about how to interpret the seemingly simple and everyday concept of probability than do our most sophisticated and complex physical theory. Generally speaking, there are two camps in the interpretations of probability: frequentists and Bayesians. As noted, every student begins as one of the former. It was in 2010 when my conversion to the latter was complete.

foundations_table.png
Summary of the interpretations of quantum theory.

In 2010, PI hosted its second course on the foundations of quantum theory. This time around I had a few years of experience under my belt and my bullshit detectors were on high alert. My final assignment was to summarize the course, as shown above. The only lectures that didn’t leave me disappointed where Chris Fuchs’. Because I had been reading up on Bayesian probability anyway, his “Quantum Bayesian” interpretation of quantum theory just clicked.

And it wasn’t just about philosophy. Concurrently, I was taking a great course on Stochastic Processes from Matt Scott. Most of this field takes an objective (frequentist) view of probability. Matt was patient with my constant questions on how to phrase the concepts in terms of the subjective Bayesian view. I was starting to feel a bit overwhelmed with the burden of translating everything to the new framework… then it happened.

jh75tdv

The assignment question was as follows: Show that \int_\infty^\infty p(x_2,x_1;t_2-t_1) d_{x_1} = p(x_2;t_2), the simplest case of the Chapman-Kolmogorov equation. What you were supposed to do is use the Markov property, p(x_2,x_1;t_2-t_1) = p(x_2|x_1;t_2-t_1)p(x_1|t_1), and integrate. It was a straightforward, but tedious, calculation. Here is what I wrote: first  p(x_2,x_1;t_2-t_1) = p(x_1|x_2;t_1-t_2)p(x_2|t_2). Since p(x_1|x_2;t_1-t_2) is a probability, it integrates to 1. Done.

This was seen as unphysical because t_1-t_2 is a negative time. So what?I thoughtprobabilities are not physical, they are subjective inferences. If I want to consider negative time to help me do my calculation, so be it. After all, I considered negative money to get me into university. But what I couldn’t believe is how difficult it was to convince others the solution was correct. It was at that moment I realized how powerful a slight change of view can be. I was a Bayesian.