How can I simplify this equation? How can I simplify this equation :
$$P=s^{T}_1A^{-1}y-\frac{1}{2}s^{T}_1A^{-1}s_1-s^{T}_0A^{-1}y+\frac{1}{2}s^{T}_0A^{-1}s_0 \tag1$$
as below equation:
$$P=(s_1-s_0)^TA^{-1}\left(y-\frac{s_0+s_1}{2}\right).\tag2$$
where T is transpose sign, $s_1,s_0,y$ are vectors and A is positive definite matrix.

We have (as positive definite means also symmetric, that $s_0^tA^{-1}s_1 = s_1^tA^{-1}s_0$):
\begin{align*}
   (s_1 - s_0)^tA^{-1}\left(y - \frac{s_0+s_1}2\right)
    &= s_1^tA^{-1}y - s_0^tA^{-1}y - \frac 12 s_1^tA^{-1}s_0 + \frac 12 s_0^tA^{-1}s_0 - \frac 12 s_1^tA^{-1}s_1 + \frac 12 s_0^tA^{-1}s_1\\
   &= s_1^tA^{-1}y - \frac 12 s_1^tA^{-1}s_1 - s_0^tA^{-1}y + \frac 12s_0^tA^{-1}s_0\\
   &= P  
\end{align*}
