# Adding Points on an Elliptic Curve

> The chord construction on the curve y² = x³ − 2x + 1: the line through two points meets the curve in a third point, and its mirror image is their sum.

An elliptic curve is the set of points with $y^2 = x^3 + ax + b$. Its points can be added, and the rule is a drawing. Take two points $P$ and $Q$ of the curve and draw the line through them. The line meets the curve in one more point, $R$ (when the line touches the curve at $P$, $R$ is $P$ itself). The sum $P + Q$ is the mirror image of $R$ in the $x$-axis.

The third point has a formula. If the line has the slope $m$, putting its equation into the equation of the curve gives a cubic equation in $x$ whose three roots add up to $m^2$. Two of the roots are the $x$-coordinates $s$ of $P$ and $k$ of $Q$, so the third is $w = m^2 - s - k$. With this addition, and one extra point at infinity that plays the part of zero, the points of the curve form a group: the order of the terms does not matter, $(P + Q) + T = P + (Q + T)$, and the mirror image of a point is its opposite. The cryptography that protects most connections on the web uses this group, on curves whose coordinates are whole numbers modulo a large prime.

This curve, $y^2 = x^3 - 2x + 1$, has two parts, an oval and an open branch. $P$ (blue) moves on the oval and $Q$ (blue) on the branch; $R$ is orange and $P + Q$ is red. The document has no point that can be dragged, so the two sliders $s$ and $k$ set the $x$-coordinates of $P$ and $Q$. Their ranges keep $P$ and $Q$ apart, so the line is never vertical. For some positions it touches the oval at $P$; the orange point then covers $P$, and $P + Q$ is the mirror image of $P$.

After a JSXGraph example by The Center of Mobile Learning with Digital Technology.

- [Open the interactive version](https://graph-paper.io/showcase/en/elliptic-curve-group-law)
- [Learn more on Wikipedia](https://en.wikipedia.org/wiki/Elliptic_curve)
