<s>[INST] Trigonometric version of second difference I am reading an article
Hall P, Turlach BA. On the estimation of a convex set with corners. IEEE Transactions on Pattern Analysis and Machine Intelligence. 1999 Mar;21(3):225-34
and stuck at an identity used there (p. 228). It can be written as follows:
$$
p(\theta_i)\sin(\theta_j - \theta_k) + p(\theta_j)\sin(\theta_k - \theta_i) + p(\theta_k)\sin(\theta_i - \theta_j) = -\frac{1}{2}(\theta_i - \theta_j)(\theta_j - \theta_k)(\theta_k - \theta_i)\{p(\theta_j) + p''(\theta_j)\} + O\{(\theta_k - \theta_i)^4\},
$$
where $-\pi < \theta_i < \theta_j < \theta_k < \pi$ and $p:(-\pi, \pi) \to \mathbb{R}$ is a function with three bounded derivatives on $[\theta_i, \theta_k]$.
Authors call this idenitity as trigonometric version of second difference. In the paper $p(\theta)$ is a support function of the convex figure on the plane, but the idenitity does not require this property.
I have tried to prove this idenitity, but failed. Here are my steps:


*

*We can write the identity in the equivalent form, by dividing both parts by $(\theta_i - \theta_j)(\theta_j - \theta_k)(\theta_k - \theta_i)$ and multiplying by $-1$:
$$
\frac{1}{2}\{p(\theta_j) + p''(\theta_j)\} = \frac{p(\theta_i)\sin(\theta_k - \theta_j) - p(\theta_j)\sin(\theta_k - \theta_i) + p(\theta_k)\sin(\theta_j - \theta_i)}{(\theta_j - \theta_i)(\theta_k - \theta_j)(\theta_k - \theta_i)} + O(\theta_k - \theta_i),
$$

*Substitute sines with first two parts of Taylor series as $\sin x = x - \dfrac{x^3}{6} + O(x^5)$:
$$
\frac{1}{2}\{p(\theta_j) + p''(\theta_j)\} = \frac{p(\theta_i)(\theta_k - \theta_j) - p(\theta_j)(\theta_k - \theta_i) + p(\theta_k)(\theta_j - \theta_i)}{(\theta_j - \theta_i)(\theta_k - \theta_j)(\theta_k - \theta_i)} - \frac{1}{6} \frac{p(\theta_i)(\theta_k - \theta_j)^3 - p(\theta_j)(\theta_k - \theta_i)^3 + p(\theta_k)(\theta_j - \theta_i)^3}{(\theta_j - \theta_i)(\theta_k - \theta_j)(\theta_k - \theta_i)} + O(\theta_k - \theta_i),
$$


*We can write a second divided difference in classic form without sines:
$$
\frac{1}{2}p''(\zeta) = \frac{p(\theta_i)(\theta_k - \theta_j) - p(\theta_j)(\theta_k - \theta_i) + p(\theta_k)(\theta_j - \theta_i)}{(\theta_j - \theta_i)(\theta_k - \theta_j)(\theta_k - \theta_i)}
$$
for some $\zeta \in [\theta_i, \theta_k]$ (see e.g. Bakhvalov N.S. Numerical methods: analysis, algebra, ordinary differential equations. MIR Publishers, 1977. P. 50).
Hence,
$$
\frac{1}{2}p''(\theta_j) = \frac{p(\theta_i)(\theta_k - \theta_j) - p(\theta_j)(\theta_k - \theta_i) + p(\theta_k)(\theta_j - \theta_i)}{(\theta_j - \theta_i)(\theta_k - \theta_j)(\theta_k - \theta_i)} + O(\theta_k - \theta_i),
$$
because $p''(\theta_j) = p''(\zeta) + O(\theta_k - \theta_i)$.

*After the subtraction of the second identity from the first one, we obtain:
$$
\frac{p(\theta_j)}{2} = - \frac{1}{6} \frac{p(\theta_i)(\theta_k - \theta_j)^3 - p(\theta_j)(\theta_k - \theta_i)^3 + p(\theta_k)(\theta_j - \theta_i)^3}{(\theta_j - \theta_i)(\theta_k - \theta_j)(\theta_k - \theta_i)} + O(\theta_k - \theta_i)
$$
The last identity does not seem to be true for any arbitrary function $p(\theta)$. If we try to take $\theta_i = \phi, \theta_j = 2 \phi, \theta_k = 3 \phi$, then
$$
\frac{p(\theta_j)}{2} = - \frac{1}{6} \frac{p(\theta_i)\phi^3 - 8 p(\theta_j)\phi^3 + p(\theta_k)\phi^3}{2 \phi^3} + O(\phi),
$$
or, equivalently,
$$
p(\theta_j) = \frac{p(\theta_i) + p(\theta_k)}{2} + O(\phi),
$$
and this is not true in the general case.
I need to prove the initial identity. Could someone find a mistake in my calculations?
 [/INST] $\def\peq{\mathrel{\phantom{=}}{}}$Since $p'''$ is bounded, then\begin{align*}
p(θ_i) &= p(θ_j) + (θ_i - θ_j) p'(θ_j) + \frac{1}{2} (θ_i - θ_j)^2 p''(θ_j) + O((θ_i - θ_j)^3), \\
p(θ_k) &= p(θ_j) + (θ_k - θ_j) p'(θ_j) + \frac{1}{2} (θ_k - θ_j)^2 p''(θ_j) + O((θ_k - θ_j)^3).
\end{align*}
Also,\begin{align*}
\sin(θ_i - θ_j) &= (θ_i - θ_j) - \frac{1}{6} (θ_i - θ_j)^3 + O((θ_i - θ_j)^4), \\
\sin(θ_j - θ_k) &= (θ_j - θ_k) - \frac{1}{6} (θ_j - θ_k)^3 + O((θ_j - θ_k)^4), \\
\sin(θ_k - θ_i) &= (θ_k - θ_i) - \frac{1}{6} (θ_k - θ_i)^3 + O((θ_k - θ_i)^4).
\end{align*}
Note that $|θ_i - θ_j| \leqslant |θ_k - θ_i|$, $|θ_j - θ_k| \leqslant |θ_k - θ_i|$. After combining terms with respect to $p(θ_j)$, $p'(θ_j)$, $p''(θ_j)$,\begin{align*}
&\peq p(θ_i) \sin(θ_j - θ_k) + p(θ_j) \sin(θ_k - θ_i) + p(θ_k) \sin(θ_i - θ_j) \\
&= A_0 p(θ_j) + A_1 p'(θ_j) + A_2 p''(θ_j) + O((θ_k - θ_i)^4),
\end{align*}
where\begin{align*}
A_0 &= (θ_j - θ_k) + (θ_k - θ_i) + (θ_i - θ_j) \\
&\peq - \frac{1}{6} ((θ_j - θ_k)^3 + (θ_k - θ_i)^3 + (θ_i - θ_j)^3) \\
&= -\frac{1}{6} ((θ_j^3 - 3θ_j^2 θ_k + 3θ_j θ_k^2 - θ_k^3) + (θ_k^3 - 3θ_k^2 θ_i + 3θ_k θ_i^2 - θ_i^3) \\
&\peq + (θ_i^3 - 3θ_i^2 θ_j + 3θ_i θ_j^2 - θ_j^3)) \\
&= -\frac{1}{2} (-θ_i^2 θ_j + θ_i θ_j^2 - θ_j^2 θ_k + θ_j θ_k^2 - θ_k^2 θ_i + θ_k θ_i^2) \\
&= -\frac{1}{2} (θ_i - θ_j)(θ_j - θ_k)(θ_k - θ_i),
\end{align*}$$
A_1 = (θ_i - θ_j)(θ_j - θ_k) + (θ_k - θ_j)(θ_i - θ_j) = 0,
$$\begin{align*}
A_2 &= \frac{1}{2} (θ_i - θ_j)^2 (θ_j - θ_k) + \frac{1}{2} (θ_k - θ_j)^2 (θ_i - θ_j) \\
&= -\frac{1}{2} (θ_i - θ_j)(θ_j - θ_k)(θ_k - θ_i).
\end{align*}
Therefore,\begin{align*}
&\peq p(θ_i) \sin(θ_j - θ_k) + p(θ_j) \sin(θ_k - θ_i) + p(θ_k) \sin(θ_i - θ_j) \\
&= -\frac{1}{2} (θ_i - θ_j)(θ_j - θ_k)(θ_k - θ_i) (p(θ_j) + p''(θ_j)) + O((θ_k - θ_i)^4).
\end{align*}
</s>