Intuition, Vocabulary and Foundations
Scalar multiplication computes $[k]P$ without adding $P$ exactly $k$ times. Like binary exponentiation, it doubles for each scalar bit and adds selected powers. On $E:y^2=x^3+2x+2\pmod{17}$, the point $P=(5,1)$ has order $19$, so $[19]P=\mathcal O$ and subgroup scalars may be reduced modulo $19$.
Affine formulas use field inversions. Projective coordinates represent the same point by a triple such as $(X:Y:Z)$ with $x=X/Z^2$ and $y=Y/Z^3$, replacing loop inversions with multiplications and one final inversion. Exceptional cases—identity, inverse pairs, and doubling a point with $y=0$—must be defined explicitly.
Scalar multiplication is binary exponentiation in an elliptic-curve group. Correctness begins before the bit loop: validate the curve, input point, infinity representation, subgroup assumption, and every exceptional addition case.
| Concept | Example | Boundary | Question answered |
|---|---|---|---|
| Infinity | $\mathcal O$ is identity and $[0]P=\mathcal O$ | A sentinel must never enter coordinate arithmetic | How is the identity represented? |
| Inverse | $-(x,y)=(x,-y\bmod p)$ | Negating both coordinates is wrong | What happens for opposite points? |
| Doubling | Slope $(3x^2+a)/(2y)$ when $y\ne0$ | If $y=0$, doubling returns infinity | Which exceptional case replaces division? |
| Projective point | $(X:Y:Z)$ encodes $(X/Z^2,Y/Z^3)$ | Multiple triples encode one affine point | How are inversions avoided? |
| Subgroup order | For $P=(5,1)$, $[19]P=\mathcal O$ | Reducing by an unverified number changes meaning | When may a scalar be reduced? |
| Scalar bits | $13=(1101)_2$ | Wrong bit order violates the invariant | Which group operations are required? |
Step-by-Step Derivations and Algorithms
Left-to-right double-and-add maintains $R=[v]P$ for the processed bit prefix $v$. Reading bit $b$ changes the prefix to $2v+b$, so double $R$ and add $P$ only when $b=1$.
A width-$w$ method precomputes $[0]P$ through $[2^w-1]P$ and processes base-$2^w$ digits, trading memory for fewer online additions. The ladder maintains adjacent multiples $R_0=[v]P$ and $R_1=[v+1]P$. Each bit performs one addition and one doubling, updating to adjacent multiples for prefix $2v+b$.
flowchart TD
A[Validate curve, point, and subgroup] --> B[Normalize sign and scalar]
B --> C{Strategy}
C -->|Double-and-add| D[Double and conditionally add]
C -->|Window| E[Precompute table and process digits]
C -->|Ladder| F[Maintain adjacent multiples]
D --> G[Verify result on curve]
E --> G
F --> G
Double-and-add preserves $R=[v]P$, the ladder preserves $R_0=[v]P$ and $R_1=[v+1]P$, and a window method preserves the processed base-$2^w$ prefix. Each needs $O(\log k)$ group operations; a width-$w$ table stores $O(2^w)$ points, while projective formulas defer inversion until the end.
Implementation, Complexity and Engineering
The reference uses affine coordinates for auditability. It rejects singular curves and off-curve points, handles infinity and vertical lines, supports negative scalars, and reduces modulo a supplied subgroup order only after verifying $[r]P=\mathcal O$. The ladder's regular operation count is educational structure, not a constant-time guarantee in Python.
| Strategy | Cost and storage | Failure mode | Mitigation |
|---|---|---|---|
| Affine double-and-add | $O(\log k)$ steps with inversions | Scalar-dependent branches and costly inversion | Use for teaching or public data |
| Projective method | One final inversion | More complex exceptional formulas | Use reviewed formulas |
| Fixed window | Fewer additions, $O(2^w)$ table | Secret-dependent lookup may leak | Constant-time table selection |
| Ladder | One add and double per bit | High-level branch still leaks | Conditional swaps and fixed bit length |
| Scalar reduction | Shortens work | Wrong order changes semantics | Verify subgroup order first |
| Audited library | Tested production implementation | Wrappers may skip validation | Preserve parameter and point checks |
Applications, Case Studies and Exercises
On the toy curve, $13=(1101)_2$ and every strategy returns $(16,4)$. A realistic comparison should count field multiplications, squarings, and inversions separately and distinguish public scalars from secret scalars, where timing and memory-access regularity matter.
Apply Elliptic-Curve Scalar Multiplication
Case study 1. Trace double-and-add, a width-two window, and the ladder for $k=13$. Success means all return $(16,4)$ and every intermediate point remains on the curve.
Case study 2. Cross-check all $0\le k\lt19$, then benchmark reproducible larger public scalars while counting additions, doublings, inversions, table entries, and scalar-dependent branches. Success means outputs agree and speed is separated from side-channel structure.
Exercises. Prove the ladder invariant; add Jacobian coordinates; test infinity, $y=0$, negative scalars, off-curve inputs, and bad subgroup orders; document what a constant-time table lookup requires from the runtime.
Use affine double-and-add for transparent public examples, projective windows for reviewed throughput code, and an audited constant-time ladder or window routine for secrets. Never reduce by an unverified order, omit point validation, or infer constant-time behavior from a regular-looking high-level loop.