ArticleslgStudy

computer science

Discrete logarithm

Discrete logarithm 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 Discrete logarithm rather than just read about it. In short: In mathematics, for given real numbers a and b, the logarithm logb(a) is a number x such that bx=a. The discrete logarithm is an analogous concept in group theory.

Discrete logarithm — main illustration
Discrete logarithm — illustration

Key takeaways

  • Discrete logarithm 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 Discrete logarithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Discrete logarithm from memory before moving on to harder problems.

Reference excerpt

In mathematics, for given real numbers a and b, the logarithm logb(a) is a number x such that bx=a. The discrete logarithm is an analogous concept in group theory. In any group G, powers bk can be defined for all integers k, and the discrete logarithm logb(a) is an integer k such that bk=a. In the special case of arithmetic modulo an integer m, the more commonly used term is index: One can write k=indba(modm) when bk≡a(modm). Discrete logarithms are quickly computable in a few special cases, but no efficient method is known for computing them in general. Several cryptographic systems, including Diffie–Hellman and ElGamal, base their security on the hardness assumption that the discrete logarithm problem over carefully chosen groups has no efficient solution. In general, there is no subexponential time solution for black box groups.

Definition Let G be any group. Denote its group operation by multiplication and its identity element by 1. Let b be any element of G. For any positive integer k, the expression bk denotes the product of b with itself k times: bk=b⋅b⋅…⋅b⏟kfactors. Similarly, let b−k denote the product of b−1 with itself k times. For k=0, the kth power is the identity: b0=1. Let a also be an element of G. An integer k that solves the equation bk=a is termed a discrete logarithm (or simply logarithm, in this context) of a to the base b. One writes k=logba.

Examples

Powers of 10 The powers of 10 are …,0.001,0.01,0.1,1,10,100,1000,…. For any number a in this list, one can compute log10a. For example, log1010000=4, and log100.001=−3. These are instances of the discrete logarithm problem. Other base-10 logarithms in the real numbers are not instances of the discrete logarithm problem, because they involve non-integer exponents. For example, the equation log1053=1.724276… means that 101.724276…=53. While integer exponents can be defined in any group using products and inverses, arbitrary real exponents, such as this 1.724276…, require other concepts such as the exponential function. In group-theoretic terms, the powers of 10 form a cyclic group G under multiplication, and 10 is a generator for this group. The discrete logarithm log10a is defined for any a in G.

Powers of a fixed real number A similar example holds for any non-zero real number b. The powers form a multiplicative subgroup G={…,b−2,b−1,1,b1,b2,…} of the non-zero real numbers. For any element a of G, one can compute logba.

Modular arithmetic Let p be a prime number, and let Zp× be the group multiplicative group of integers modulo p. Its elements are non-zero congruence classes modulo p, which can be written 1,2,3,…,p−1. The group product of two elements is obtained by ordinary integer multiplication followed by reduction modulo p. The kth power of one of the numbers in this group may be computed by finding its kth power as an integer and then finding the remainder after division by p. When the numbers involved are large, it is more efficient to reduce modulo p multiple times during the computation. Regardless of the specific algorithm used, this operation is called modular exponentiation. For example, consider Z17×. To compute 34 in this group, compute 34=81, and then divide 81 by 17, obtaining a remainder of 13. Thus 34=13 in the group Z17×. The discrete logarithm is just the inverse operation. For example, consider the equation 3k≡13(mod17). From the example above, one solution is k=4, and therefore log313=4 in Z17×. However, 4 is not the only solution. Because 316≡1(mod17), it follows that if n is any integer then 34+16n≡34⋅(316)n≡34⋅1n≡34≡13(mod17). Hence the equation has infinitely many solutions of the form 4+16n. Moreover, because 16 is the smallest positive integer m satisfying 3m≡1(mod17), these are the only solutions. Equivalently, the set of all possible solutions can be expressed by the constraint that k≡4(mod16).

Powers of the identity In the special case where b is the identity element 1 of the group G, the discrete logarithm logba is undefined for a other than 1, and every integer k is a discrete logarithm for a=1.

Elliptic curve Let C be a Weierstrass normal form elliptic curve in the projective plane over a field F. Let O be the point at infinity on C. For any points P and Q of C, let P # Q denote the unique third point of C, where the line through P and Q intersects C. (If P = Q, then the line in question is the line tangent to C at P. If P = Q = O, then P # Q = O.) Define an "addition" operation on C by P+Q=(P#Q)#O. This addition operation makes C a commutative group with identity element O. For any point P of C, let kP=P+P+⋯+P denote the sum of k copies of P. In this context, the discrete logarithm problem is: Given points P and Q, find k such that Q=kP. When the underlying field F is a finite field, this problem has cryptographic applications.

Properties Powers obey the usual algebraic identity bk+l=bk⋅bl. In other words, the function f:𝐙→G defined by f(k)=bk is a group homomorphism from the group of integers 𝐙 under addition onto the subgroup H of G generated by b. For all a in H, logba exists. Conversely, logba does not exist for a that are not in H. If H is infinite, then logba is also unique, and the discrete logarithm amounts to a group isomorphism logb:H→𝐙. On the other hand, if H is finite of order n, then logba is unique only up to congruence modulo n, and the discrete logarithm amounts to a group isomorphism logb:H→𝐙n, where 𝐙n denotes the additive group of integers modulo n. The familiar base change formula for ordinary logarithms remains valid: If c is another generator of H, then logca=logcb⋅logba.

Algorithms

… excerpt ends here. Continue reading the full article.

Illustrations

Discrete logarithm: Discrete logarithms modulo 5 to base 2. Each arrow represents multiplication by 2 modulo 5. Starting at 1, the discrete logarithm of a nonzero residue is the number of arrows needed to reach it, modulo 4.
Discrete logarithms modulo 5 to base 2. Each arrow represents multiplication by 2 modulo 5. Starting at 1, the discrete logarithm of a nonzero residue is the number of arrows needed to reach it, modulo 4.

Worked examples

Example 1 — a first encounter with Discrete logarithm

Start with the simplest possible case. Write down what Discrete logarithm 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 Discrete logarithm 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 Discrete logarithm 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 Discrete logarithm

In research
Discrete logarithm 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 Discrete logarithm 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
Discrete logarithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational hardness assumptions, Cryptography, Finite fields, so understanding it makes those chapters shorter.
In everyday life
Look for Discrete logarithm 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.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Discrete logarithm” →

How to study Discrete logarithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Discrete logarithm 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 Discrete logarithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Discrete logarithm in simple terms?

In mathematics, for given real numbers a and b, the logarithm logb(a) is a number x such that bx=a. The discrete logarithm is an analogous concept in group theory.

Why does Discrete logarithm 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 Discrete logarithm?

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 Discrete logarithm.

Tags

  • Computational hardness assumptions
  • Cryptography
  • Finite fields
  • Group theory
  • Logarithms
  • Modular arithmetic
  • Unsolved problems in computer science

Keep exploring