Recently, I encoutered the following objective function
$$ \text{minimize}\quad \mathbf E(\mathbf X)=\mathbf X^{\text T}\mathbf K \mathbf X\\ \text{s.t.} \quad\mathbf A\mathbf X=\mathbf P $$
where
$\mathbf X=[x_0,\cdots,x_{\hat n+p}]^{\text T}\leftarrow\color{red}{\text{unknown}}\\ \mathbf K=(k_{i,j})_{(\hat n+p+1)\times (\hat n+p+1)}\leftarrow \color{red}{\text{known }} \text{symmetric stiffness matrix}\\ \mathbf A=(a_{i,j})_{(n+1)\times (\hat n+p+1)}\leftarrow\color{red}{\text{known }} \text{coefficient matrix}\\ \mathbf P=[p_0,\cdots,p_{n}]^{\text T}\leftarrow \color{red}{\text{known }}$
Here "unknown" dneotes "unknown variable", while "known" denotes "known parameters"
When the unknown variables $\mathbf X$ is different, I can use the Lagrange multiplier as follows:
(1)define the Lagrange function $$ \mathbf L(\mathbf X,\mathbf v)=\mathbf X^{\text T}\mathbf K \mathbf X+2\mathbf v^{\text T}(\mathbf A\mathbf X-\mathbf P)\\ \mathbf v=[v_0,\cdots,v_{\hat n+p+1}] $$ (2)calculate the partial derivative with respect $\mathbf X$ and $\mathbf v$
$$ \begin{cases} \Large{\frac{\partial \mathbf L}{\partial \mathbf X}}\normalsize=(\mathbf K+\mathbf K^{\text T})\mathbf X+2\mathbf A \mathbf v^{\text T}\leftarrow(\mathbf K=\mathbf K^{\text T})\\ \Large{\frac{\partial \mathbf L}{\partial \mathbf v}}=\normalsize 2(\mathbf A \mathbf X-\mathbf P)\\ \end{cases} $$ Then let $$ \frac {\partial \mathbf L}{\partial \mathbf X}=\mathbf O\\ \frac {\partial \mathbf L}{\partial \mathbf v}=\mathbf O\\ $$
I can achieve the below block matrix linear system $$ \begin{pmatrix} \mathbf K & \mathbf A^{\text{T}}\\ \mathbf A & \mathbf O \end{pmatrix} \begin{pmatrix} \mathbf X\\ \mathbf v \end{pmatrix} = \begin{pmatrix} \mathbf O\\ \mathbf P \end{pmatrix} $$
where, $\mathbf O$ denotes zero matrix/vector.
However, when the unknown variable $\mathbf X$ has same part. That is, for the $\mathbf X=[x_0,\cdots,x_{\hat n},x_{\hat n+1},\cdots,x_{\hat n+p}]^{\text T}$
$$x_{\hat n+i}=x_{i-1}\qquad i=1,2,\cdots,p$$
For this case, I just need introduce $\hat n+1$ Lagrange multiplier. Namely,
$$\mathbf v=[v_0,\cdots,v_{\hat n}]^{\text T}$$
But I don't know how to build Lagrange function. Could someone give me some suggestions? Thanks in advance!