Let an expression $X^T AX+B^TX$, how can I transform it as $Y^T C Y$; where $Y=[X, 1]$,
and $C$ is expressed as (in terms of $A$ and $B$):
$$C=\begin{pmatrix} A & \frac12B\\ \frac12B^T & 0\end{pmatrix}$$
My question in case, the above expression is very complex in form (some other variables can be multiplied or added), in general what are the steps to find $C$?
Size of $X$ is $N\times 1$, $Y$ is $(N+1)\times 1$, $A$ is $N\times N$, $B$ is $N\times 1$, and $C$ is $(N+1)\times (N+1)$
We have $$X^TAX+B^TX= \sum_{i=1}^N\sum_{j=1}^N A_{ij}X_iX_j + \sum_{j=1}^N B_jX_j$$
On the other hand, we have \begin{align} Y^TCY &= \sum_{i=1}^{N+1}\sum_{j=1}^{N+1} C_{ij}Y_iY_j\\ &= \sum_{i=1}^{N}\sum_{j=1}^{N} C_{ij}X_iX_j + \sum_{j=1}^N C_{(N+1)j}X_j + \sum_{i=1}^N C_{i(N+1)}X_i+ C_{(N+1)(N+1)}\\ &=\sum_{i=1}^{N}\sum_{j=1}^{N} C_{ij}X_iX_j + \sum_{j=1}^N (C_{(N+1)j} + C_{j(N+1)})X_j+ C_{(N+1)(N+1)} \end{align}
For these two expressions to be equal, we can set
resulting in $$C=\begin{pmatrix} A & \frac12B\\ \frac12B^T & 0\end{pmatrix}$$