Let $X$ be an irreducible non-singular curve of genus $g$, embedded in $\mathbb{P}^n$ via the canonical embedding.
Let $j$ be an integer, and $P\in X$ a point on the curve. I would like to prove the following statement:
The integer $j+1$ is a Weierstrass gap for $P$ if and only if there exists a hyperplane $H\subseteq\mathbb{P}^{n}$ such that $H$ intersects $X$ at $P$ with multiplicity exactly $j$.
Recall that an integer $s$ is called a Weierstrass gap for a point $P\in X$ if there does not exist any meromorphic function $f$ on $X$ such that $f$ is regular outside of $P$, and has pole of order $s$ at $P$.
This should apparently follow from Riemann-Roch Theorem. Which line bundles should I apply the Riemann-Roch theorem on? This seems to be an important characterization of Weierstrass points, so it might be helpful to have a canonical answer in this website.
Let $s=j+1$. A meromorphic function with a pole of order $s$ at $P$ which is regular at all other points is exactly a section of $\mathcal{O}_X(sP)$ which is not a section of $\mathcal{O}_X((s-1)P)$. So $s$ is a Weierstrass gap at $P$ iff $$\ell(sP)=\ell((s-1)P).$$ By Riemann-Roch, this is equivalent to $$\ell(K-sP)=\ell(K-(s-1)P)-1$$ where $K$ is the canonical divisor. That is, $s$ is a Weierstrass gap at $P$ iff there is a section of $\mathcal{O}_X(K-(s-1)P)$ which is not a section of $\mathcal{O}_X(K-sP)$. This condition is equivalent to the existence of a divisor $D$ linearly equivalent to $K$ such that $D-(s-1)P$ is effective but $D-sP$ is not effective. But this just means $D$ is effective and $s-1$ is the coefficient of $P$ in $D$. The effective divisors which are linearly equivalent to $K$ are exactly the hyperplane sections of $X$ for its canonical embedding. So our condition is equivalent to the existence of a hyperplane section of the canonical embedding that contains $P$ with multiplicity $s-1=j$, as desired.