$$\Large\textbf{Given Problem}$$
Let $p,q,r$ be continuous functions on $[0,L]$ such that $p'$ is also continuous, and $p$ and $r$ are positive. Define $$L[X] = \dfrac{(pX')' - qX}{r}$$ Show, using integration by parts, that $L$ is a formally self-adjoint operator.
$$\large{\textbf{My Attempt and Thoughts for this Problem}}$$
I need to show that
$$\langle Lu,v\rangle_r = \langle u,Lv\rangle_r + \text{some boundary terms}$$
where $r$ is the weight function. First, I evaluate $\langle Lu,v\rangle_r$, which gives
$$\begin{aligned} \langle Lu,v \rangle_r &= \int_0^L \dfrac{(pu')' - qu}{r}\cdot vr\,dx\\ &= \int_0^L (v(pu')' - vqu)\,dx\\ &= \int_0^L v(pu')'\,dx - \int_0^L vqu\,dx\\ &= vpu'\bigg\vert_{x = 0}^{x = L} - \int_0^L u'v'p\,dx - \int_0^L quv\,dx \end{aligned}$$
where $vpu'\bigg\vert_{x = 0}^{x = L}$ is some constant. Then, for the right-hand side
$$\begin{aligned} \langle u,Lv\rangle_r &= \int_0^L ((pv')' - qv)u\,dx\\ &= \int_0^L u(pv')'\,dx - \int_0^L quv\,dx\\ &= upv'\bigg\vert_{x = 0}^{x = L} - \int_0^L u'v'p\,dx - \int_0^L quv\,dx \end{aligned}$$
where $upv'\bigg\vert_{x = 0}^{x = L}$ is some constant. Noticing both equations have same integrals, but different constants, can I conclude that the equality holds, or am I on the wrong path, or will I need to reconsider my method?