# Adding of two elliptic curve points

I'm working on elliptic curve points, and I know that some possible points require separate consideration. For example, if I want to add points P and Q, and P is a point in infinity and Q is a point in infinity - I will have the infinity point. If Q = -P, adding P + Q results in the infinity point. But what in the cases:

• if $P = (x,y1)$ and $Q = (-x, y2)$
• if $P = (x, y1)$ and $Q = (-x, y1)$

Points P and Q are not opposite, since the plot is symmetric over axes x, not axes y. Should I treat those cases somehow separately? Are those points even on the same curve?

No, the points may not be on the same curve. Say, we have the elliptic curve $y^2=x^3+17$ over $\mathbb{Q}$. Then the point $(x,y_1)=(8,23)$ lies on the curve, but there is no rational point $(-x,y_2)=(-8,y_2)$ on it.