# Indefinite Integrals - Constant of Integration Question

I am reading "An Introduction to Numerical Analysis" by K. Atkinson, 2nd edition. On page 167, it states:

$$s''(x) = \frac{(x_{i+1}-x)M_i + (x-x_i)M_{i+1}}{h_i}$$

Integrating twice, the result in the textbook is:

$$s(x) = \frac{(x_{i+1}-x)^3 M_i + (x-x_i)^3 M_{i+1}}{6h_i} + C(x_{i+1}-x) + D(x-x_i)$$

I am curious why there are not additional constants, $E$ and $F$ in the expression for $s(x)$.

I get,

$$s_1(x) = \int \frac{(x_{i+1}-x)M_i + (x-x_i)M_{i+1}}{h_i} dx$$ $$= \int \frac{(x_{i+1}-x)M_i}{h_i} dx + \int \frac{(x-x_i)M_{i+1}}{h_i} dx$$ $$= \int \frac{u M_i}{h_i} (-1) du + \int \frac{vM_{i+1}}{h_i} dv$$ $$= \frac{u^2}{2h_i}M_i (-1) + C_1 + \frac{v^2 M_{i+1}}{2h_i} + C_2$$ $$= \frac{(x_{i+1}-x)^2 M_i (-1)}{2h_i} + C_1 + \frac{(x-x_i)^2 M_{i+1}}{2h_i} + C_2$$

$$s(x) = \int s_1(x) dx$$ $$= \int \left[\frac{(x_{i+1}-x)^2 M_i (-1)}{2h_i} + C_1 \right]dx + \int \left[\frac{(x-x_i)^2 M_{i+1}}{2h_i} + C_2 \right]dx$$ $$= \int \left[\frac{u^2 M_i (-1)}{2h_i} + C_1 \right]du (-1) + \int \left[\frac{v^2 M_{i+1}}{2 h_i} + C_2 \right]dv$$ (Eq 0) $$= \int \left[\frac{u^2 M_i}{2 h_i} + C_1 \right]du + \int \left[\frac{v^2 M_{i+1}}{2 h_i} + C_2 \right]dv$$ (Eq 1) $$= \frac{u^3 M_i}{6 h_i} + C_1 u + C_3 + \frac{v^3 M_{i+1}}{6 h_i} + C_2 v + C_4$$ $$s(x) = \frac{(x_{i+1}-x)^3 M_i + (x-x_i)^3 M_{i+1}}{6h_i} + C_1(x_{i+1}-x) + C_2(x-x_i) + C_3 + C_4$$

Note that in moving from (Eq 0) to (Eq 1), I did: $\int C_1 du (-1) = \int C_1 du$, since $C_1$ is some constant. Note that the last equation matches the original equation from the text, except I have additional $C_3$ and $C_4$ terms. (Let $C_1 = C$, $C_2 = D$.) Can some please explain how to make my result match the result in the book?

Thanks.

-
Note that in the line $\frac{(x_{i+1}-x)^2 M_i (-1)}{2h_i} + C_1 + \frac{(x-x_i)^2 M_{i+1}}{2h_i} + C_2$, you can merge the $C_1$ and $C_2$ into a single arbitrary constant... – J. M. Sep 15 '11 at 14:21

First, $C_3$ and $C_4$ can be added to make a single constant, which we can call $C_5$. Then $C_5$ can be absorbed into $C_1$ and $C_2$. If you change $C_1$ and $C_2$ to $C_1+C_6$ and $C_2+C_6$, the term in $x$ is not changed, while the constant term is increased by $C_6(x_{i+1}-x_i)$. So as long as $x_{i+1} \ne x_i$ we can choose an appropriate $C_6$.
what will happen if $x_{i+1} = x_i$? – Ilya Sep 15 '11 at 14:37
@J.M. I guess that from the context we always have this inequality as these are grid points. So does it mean that the result from the textbook does not hold in general (for arbitrary $x_{i+1},x_i$)? – Ilya Sep 15 '11 at 15:31
@Ross Millikan: If we do (from the book's equation, except the cubed terms): $C = C' + C_6$ and $D = D' + C_6$, we get: $(C'+C_6)(x_{i+1}-x) + (D'+C_6)(x-x_i) = C'(x_{i+1}-x) + D'(x-x_i) + C_6(x_{i+1}-x_i)$. Note that $C_6(x_{i+1}-x_i) = C_5 = C_3+C_4$. But, if consider the unknowns $C$ and $D$, we need only two equations to solve for $C$ and $D$. But, if we consider the unknowns $C = C'+C_6$ and $D = D'+C_6$, we need three equations to solve for $C'$, $C_6$, and $D'$. Will there be any instances where this will be a problem? (Assuming we can only get two (point, value) pairs.) – jrand Sep 15 '11 at 15:43
@jrand: as Gortaur says, there are only two degrees of freedom: the constant and linear term, so you only need two constants. If you have three, there will be another degree of freedom and you won't find a unique solution. I showed (assuming $x_{i+1} \ne x_i$, which will always be true here) how to find them. – Ross Millikan Sep 15 '11 at 16:03