The derivation of the cubic spline interpolation (from this MIT OCW lecture, page 13) starts off with second derivatives, which are piecewise linear functions. It's written in the form
$$ s''(x) = \frac{x_j - x}{h_j}\sigma_{j-1} + \frac{x - x_{j-1}}{h_j}\sigma_{j}, h = x_j - x_{j-1}, \sigma_{j} = s''(x_j) $$
which is confusing to me, because I think of it as
\begin{align*} s''(x) = f(x) &= \frac{f_{j} - f_{j-1}}{x_j - x_{j-1}}(x - x_j) \\ &= \frac{f_{j}}{h_j}(x - x_j) - \frac{f_{j-1}}{h_j}(x - x_j) \\ &= \frac{f_{j}}{h_j}(x - x_j) + \frac{f_{j-1}}{h_j}(x_j - x) = \frac{\sigma_{j}}{h_j}(x - x_j) + \frac{\sigma_{j-1}}{h_j}(x_j - x) \\ &= \frac{x - x_j}{h_j}\sigma_{j} + \frac{x_j - x}{h_j}\sigma_{j-1} \end{align*}
which is not quite the same, and I'm confused by how they obtained that form, mainly where $x_{j-1}$ came from.
After that, they take the integral of the function twice, obtaining a function with integration constants (?)
$$\alpha_j (x - x_{j-1}) + \beta_j(x_j - x)$$
and I was under the impression one integral would give integration constant $\alpha_j$, then a second would give
$$\alpha_j (x) + \beta_j$$
The pdf's explanation doesn't really do it much justice, and so I'm confused how such an integration is possible (why is $\beta_j$ a coefficient when it should be a constant).
Could someone clarify these steps for me? Thanks!
$$ \frac{(x_{j-1}-x)f_{j-1}+(x-x_{j-1})f_{j}}{x_j-x_{j-1}} = \frac{f_j-f_{j-1}}{x_j-x_{j-1}}(x-x_{j-1}) $$