Finding a key given partial keys I'm working through an exam paper for a cryptography exam and I've come across a question I'm unsure on.

Six users have been given the partial keys below

$P(x) = (k + \sum_{i=1}^2 c_ix^i)\bmod{503}$

User X Y

1   10 25
2   20 405
3   30 272
4   40 129
5   50 479
6   60 316


Reconstruct the secret key K to verify it is 138.

I've tried using Newtons Divided Difference to skip using the formula but that didn't work. I also tried using the Chinese Remainder Theorem on the data but that did not work either. I've tried filling into the equation but I don't think I've been doing it right so any help on how to go about this question would be appreciated
Apart from the slightly unusual nomenclature, this is Shamir's secret-sharing scheme with $n=6$ and $k=3$ (i.e., the secret is shared into six pieces, any three of which can be combined to retrieve the secret).

In this case, the pieces are as follows:

$$\begin{align}(x_0, y_0) &amp;= (10, 25) \\
(x_1, y_1) &amp;= (20, 405) \\
(x_2, y_2) &amp;= (30, 272) \\
(x_3, y_3) &amp;= (40, 129) \\
(x_4, y_4) &amp;= (50, 479) \\
(x_5, y_5) &amp;= (60, 316)\end{align}$$

Only three of these are needed to retrieve the secret. As described in the Wikipedia article, this is done by calculating a set of Lagrange basis polynomials:

$$\begin{align}\ell_0 &amp;= \frac{x - x_1}{x_0 - x_1} \cdot \frac{x - x_2}{x_0 - x_2} = \frac{x - 20}{10 - 20} \cdot \frac{x - 30}{10 - 30} = \frac{x^2}{200} - \frac{x}{4} + 3 \\
\ell_1 &amp;= \frac{x - x_0}{x_1 - x_0} \cdot \frac{x - x_2}{x_1 - x_2} = \frac{x - 10}{20 - 10} \cdot \frac{x - 30}{20 - 30} = \frac{-x^2}{100} + \frac{2x}{5} - 3 \\
\ell_2 &amp;= \frac{x - x_0}{x_2 - x_0} \cdot \frac{x - x_1}{x_2 - x_1} = \frac{x - 10}{30 - 10} \cdot \frac{x - 20}{30 - 20} = \frac{x^2}{200} - \frac{3x}{20} + 1
\end{align}$$

All you need from these polynomials are the constant terms, which are multiplied by the corresponding $y$ terms to give you the secret value:

$$\begin{align}s &amp;= (3 \cdot 25 - 3 \cdot 405 + 1 \cdot 272) \pmod{503} \\
&amp;= 138 \end{align}$$