trouble in finding partial derivatives Following is my cost that I need to minimize wrt $\mathbf{y}$
\begin{equation}
J = (\mathbf{y^T\mathbf{z_1}})^2+(\mathbf{y^T\mathbf{z_2}})^2-\lambda(\mathbf{y}^T\mathbf{e}-1)
\end{equation}
$\lambda$ is a scalar varaible.
My work so far 
\begin{align}
J &= (\mathbf{y^T\mathbf{z_1}}\mathbf{z_{1}^{T}\mathbf{y}})+(\mathbf{y^T\mathbf{z_{2}}}\mathbf{z_{2}^{T}\mathbf{y}})-\lambda(\mathbf{y}^T\mathbf{e}-1)\\
&= (\mathbf{y^T\mathbf{A_1}\mathbf{y}})+(\mathbf{y^T\mathbf{A_{2}}\mathbf{y}})-\lambda(\mathbf{y}^T\mathbf{e}-1)
\end{align}
\begin{align}
\frac{\partial J}{\partial \mathbf{y}}
   &= \left( (\mathbf{A_1}+\mathbf{A_1^{T}})\mathbf{y} +  (\mathbf{A_2}+\mathbf{A_2^{T}})\mathbf{y} -\lambda\mathbf{e}\right)\\
&= \left( (\mathbf{A_1}+\mathbf{A_1^{T}} + \mathbf{A_2}+\mathbf{A_2^{T}})\mathbf{y} -\lambda\mathbf{e}\right)=0
\end{align}
this leaves
\begin{align}
\mathbf{y}
   &=  (\mathbf{A_1}+\mathbf{A_1^{T}}+\mathbf{A_2}+\mathbf{A_2^{T}})^{-1} (\lambda\mathbf{e})
\end{align}
My problem is with finding $\lambda$

Notice that $A_1$ and $A_2$ are symmetric, since $(zz^T)^T=(zz^T)$.
So going back to the derivative wrt $y$, you can write 
$$ \eqalign{
 \lambda e &= 2\,(A_1+A_2)y \cr
}$$
Next, find the gradient with respect to $\lambda$ and set it to zero
$$ \eqalign{
  \frac{\partial J}{\partial\lambda} &= y^Te-1 &= 0 \cr
  1 &= y^Te \cr
}$$
and substitute this into the first equation (multiplied by $y^T$) 
$$ \eqalign{
 \lambda y^Te &= 2\,y^T(A_1+A_2)y \cr
 \lambda &= 2\,y^T(A_1+A_2)y \cr
}$$
Finally, you can substitute this expression for $\lambda$ into your result to obtain the optimal $y$.
