ArticleslgStudy

computer science

Pocklington's algorithm

Pocklington's algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Pocklington's algorithm rather than just read about it. In short: Pocklington's algorithm is a technique for solving a congruence of the form x 2 ≡ a ( mod p ) , {\displaystyle x^{2}\equiv a{\pmod {p}},} where x and a are integers and a is a quadratic residue. The algorithm is one of the first efficient methods to solve such a congruence.

Key takeaways

  • Pocklington's algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Pocklington's algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Pocklington's algorithm from memory before moving on to harder problems.

Reference excerpt

Pocklington's algorithm is a technique for solving a congruence of the form

x 2 ≡ a ( mod p ) , {\displaystyle x^{2}\equiv a{\pmod {p}},}

where x and a are integers and a is a quadratic residue. The algorithm is one of the first efficient methods to solve such a congruence. It was described by H.C. Pocklington in 1917.

The algorithm (Note: all ≡ {\displaystyle \equiv } are taken to mean ( mod p ) {\displaystyle {\pmod {p}}} , unless indicated otherwise.) Inputs:

p, an odd prime a, an integer which is a quadratic residue ( mod p ) {\displaystyle {\pmod {p}}} . Outputs:

x, an integer satisfying x 2 ≡ a {\displaystyle x^{2}\equiv a} . Note that if x is a solution, −x is a solution as well and since p is odd, x ≠ − x {\displaystyle x\neq -x} . So there is always a second solution when one is found.

Solution method Pocklington separates 3 different cases for p: The first case, if p = 4 m + 3 {\displaystyle p=4m+3} , with m ∈ N {\displaystyle m\in \mathbb {N} } , the solution is x ≡ ± a m + 1 {\displaystyle x\equiv \pm a^{m+1}} . The second case, if p = 8 m + 5 {\displaystyle p=8m+5} , with m ∈ N {\displaystyle m\in \mathbb {N} } and

a 2 m + 1 ≡ 1 {\displaystyle a^{2m+1}\equiv 1} , the solution is x ≡ ± a m + 1 {\displaystyle x\equiv \pm a^{m+1}} .

a 2 m + 1 ≡ − 1 {\displaystyle a^{2m+1}\equiv -1} , 2 is a (quadratic) non-residue so 4 2 m + 1 ≡ − 1 {\displaystyle 4^{2m+1}\equiv -1} . This means that ( 4 a ) 2 m + 1 ≡ 1 {\displaystyle (4a)^{2m+1}\equiv 1} so y ≡ ± ( 4 a ) m + 1 {\displaystyle y\equiv \pm (4a)^{m+1}} is a solution of y 2 ≡ 4 a {\displaystyle y^{2}\equiv 4a} . Hence x ≡ ± y / 2 {\displaystyle x\equiv \pm y/2} or, if y is odd, x ≡ ± ( p + y ) / 2 {\displaystyle x\equiv \pm (p+y)/2} . The third case, if p = 8 m + 1 {\displaystyle p=8m+1} , put D ≡ − a {\displaystyle D\equiv -a} , so the equation to solve becomes x 2 + D ≡ 0 {\displaystyle x^{2}+D\equiv 0} . Now find by trial and error t 1 {\displaystyle t_{1}} and u 1 {\displaystyle u_{1}} so that N = t 1 2 − D u 1 2 {\displaystyle N=t_{1}^{2}-Du_{1}^{2}} is a quadratic non-residue. Furthermore, let

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Pocklington's algorithm

Start with the simplest possible case. Write down what Pocklington's algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Pocklington's algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Pocklington's algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Pocklington's algorithm

In research
Pocklington's algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Pocklington's algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Pocklington's algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Modular arithmetic, Number theoretic algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Pocklington's algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Pocklington's algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Pocklington's algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Pocklington's algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Pocklington's algorithm in simple terms?

Pocklington's algorithm is a technique for solving a congruence of the form x 2 ≡ a ( mod p ) , {\displaystyle x^{2}\equiv a{\pmod {p}},} where x and a are integers and a is a quadratic residue. The algorithm is one of the first efficient methods to solve such a congruence.

Why does Pocklington's algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Pocklington's algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Pocklington's algorithm.

Tags

  • Modular arithmetic
  • Number theoretic algorithms

Keep exploring