<s>[INST] In the expansion of $(1+x+x^2)^n$, find the required value If $n \in $ odd integer, such that:
$$(1+x+x^2)^n=a_0+a_1x+a_2x^2+.....+a_{2n}x^{2n}$$ and
$$(a_1)^2-(2a_2)^2+(3a_3)^2-(4a_4)^2+......-(2na_{an})^2=- \lambda n^2a_{n-1}$$ then find the value of $\lambda$.
Is there any better approach to this question rather than binomial expansion and then collection of required coefficient? 
 [/INST] $$y(x):=(1+x+x^2)^n$$
Suppose ' represents differentiation w.r.t $x$.
$$
y'(x)=n(1+x+x^2)^{n-1}(1+2x)=\sum_{k=1}^{2n}ka_kx^{k-1}
$$
Now the constant term in $y'(-x)y'(x^{-1})$ is
$$
a:=a_1-(2a_2)^2+(3a_3)^2-\cdots-(2na_{2n})^2
$$
Now
$$
y'(-x)y'(x^{-1})={n^2(1+x^2+x^4)^{n-1}(2-3x-2x^2)\over x^{2n-1}}
$$
Let $g(x)=(1+x+x^2)^{n-1}=\sum_{k=0}^{2n-2}b_{k}x^k$. Clearly $g$ is a polynomial and $g(x^2)$ does not contain odd powers of $x$. Therefore coefficients of $x^{2n-1}$ in $g(x^2)$ and $x^2g(x^2)$ are $0$. Hence
$$
\begin{align}a&=-3n^2\times(\text{Coefficient of }x^{2n-2}\text{ in }g(x^2))\\
&=-3n^2\times(\text{Coefficient of }x^{n-1}\text{ in }g(x))\\
&=-3n^2b_{n-1}\end{align}
$$
Now
$$g(x)=\sum_{j=0}^{n-1}\binom{n-1}{j}x^j(1+x)^j=\sum_{j=0}^{n-1}\sum_{r=0}^j\binom{n-1}{j}\binom{j}{r}x^{j+r}\\
\begin{align}\therefore \;b_{n-1}&=\sum_{r\le j,\;j+r=n-1}\binom{n-1}{j}\binom{j}{r}\\
&=\sum_{r=0}^{\left\lfloor\frac{n-1}{2}\right\rfloor}\binom{n-1}{n-1-r}\binom{n-1-r}{r}\\
\end{align}$$
Similar calculation shows
$$
a_{n-1}=\sum_{r=0}^{\left\lfloor\frac{n-1}{2}\right\rfloor}\binom{n}{n-1-r}\binom{n-1-r}{r}
$$
Finally,
$$\lambda=3\frac{b_{n-1}}{a_{n-1}}=3\frac{\sum_{r=0}^{\left\lfloor\frac{n-1}{2}\right\rfloor}\binom{n-1}{r}\binom{n-1-r}{r}}{\sum_{r=0}^{\left\lfloor\frac{n-1}{2}\right\rfloor}\binom{n}{r+1}\binom{n-1-r}{r}}$$
In case $n$ is odd we may remove the floor brackets.
</s>