# linear distance

Hello

I want to take linear distance beetween two points on Eliptic curve:

curve : y2=x3+7 secp256k1

```
p_string = 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F'
p = ZZ( '0x' + p_string.replace(' ', ''))
p
E = EllipticCurve( GF(p), [0, 7] )
E
n_string = 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141'
n = ZZ( '0x' + n_string.replace(' ', '') )
xP = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
yP = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
P = E.point( (xP, yP) ) # Generator point
```

We have two point on curve y2=x3+7 secp256k1 with above parameter.

Point no 1:

```
p_1_x=0x28f3c7982219bf067d9723a54bef8e0ae7d970b4285a148685ce98819bd59c99
p_1_y=0x3da6945a85ba67249e96534f3cb93af144301e3ef03f848ebf17fedd55addd14
P1 = E.point( (p_1_x, p_1_y) )
```

Point no 2:

```
p_2_x=0xc69b120facc137ad7ecf7407b97f3e1bcecec27ed6617ad1e3bb4f5a265c2230
p_2_y=0xdab461d8de9d194b9aae05cf3fc361e31b0cd172985720a9963a1fd9cb4dab13
P2 = E.point( (p_2_x, p_2_y) )
```

and we want to know what is P1-P2.

```
P1 it is p1 * P ( integer * Generator)
P2 it is p2 * P ( integer * Generator)
```

so :
(p1*P) - (p2*P), but we don't know p1 and p2 , we know only P1 and P2 as point on curve.

but we know when the 2 points P1 and P2 are equal .

the question is there any way to verify and take value P1-P2 as integer ? for example : if p1=5 and p2 =9 , then p1-p2 or P1-P2 = -4

# calculation : perform add or mult for equal :

```
a= 82096204097375626523300693245739453783745399685178560726932375997561515334942
P1_mult = P1 * a
b= 29894233847412895230616850443375888414306408440111129860511310128693381347651
P2_add = P2 + b* P
```

so P1_mult == P2_add

P1 == P2 as P1_mult and P2_add , after calculation so from this expression can we calculate what is P1-P2? so what is linear distance in integer beetween P1 and P2 if we know above information?

at the moment no idea, any tips, solution, How to do?

Please define "linear distance".

linear distance: How far are points from each other in integer values not in x,y coordinate

This is still unclear. Please give a formal definition.

edited question

Doesn't running

`P1 - P2`

in Sage answer your question? It gives