I was solving $$ \frac{\partial^2 u}{\partial t^2}=\frac{\partial^2 u}{\partial x^2}$$
All the boundary conditions are as follows:-
$$u(0,t)=0 \\ u(\pi ,t)=0 \\ u(x,0)=\sin x \\ u_t(x,0)=x^2$$
which was reduced to $$u(x,t)=(A\sin\alpha t +B\cos \alpha t).(C\sin\alpha x +D\cos \alpha x)$$
The boundary condition given as $u(t,0)=0 \implies 0=D(A\sin\alpha t +B\cos \alpha t)$
And here it said $D=0 \because A\sin\alpha t +B\cos \alpha t \neq 0$
The next boundary condition states $$u(\pi ,t)=0 \implies u(x,t)= \sum_{n=1}^\infty C\sin(nx)(A\sin nt +B\cos nt)$$
From $u(x,0)=Sin x$ I get $$Sin x= \sum_{n=1}^\infty C\sin(nx) .(A)$$
Can I say $A=1/C$?
$$---------------------------------------$$
Part 2:-
Is $A=1/C$ $$u_t(x,t)=\sum_{n=1}^\infty \frac{1}{A}\sin(nx)(-An\sin(nt) + nB\cos(nt))$$ $$u_t(x,0)= x^2 = \sum_{n=1}^\infty \frac{1}{A}\sin(nx)(nB)$$ $$ x^2 = \frac{B}{A}\sum_{n=1}^\infty n \sin(nx)$$
How to solve this?
You are solving the so-called wave equation. After separating variables we obtain for the space-dependent part
$X(x) = C\sin\alpha x + D\cos\alpha x$.
The first boundary condition yields $X(0) = 0$, and results in $D=0$. The second boundary condition becomes $X(\pi) = 0$ and leads to $C\sin\alpha\pi = 0$. If $B=0$, then the solution is trivial, i.e. $X \equiv 0$. In order to find non-trivial solution, we let $\sin\alpha \pi = 0$ or $\alpha \pi = \pi n$, where $n\in\mathbb{N}$. This results in $\alpha = n$ and, thus,
$X(x) = C\sin nx$.
The solution of the temporal equation becomes
$T(t) = A\sin nt + B\cos nt$,
and the overall solution now reads
$u(x,t) = \sum_{n=1}^{\infty}\sin nx(A_n\sin nt + B_n\cos nt)$,
where we have absorbed constant $C$ in $A_n$ and $B_n$. Now we apply initial conditions. The first gives
$u(x, 0) = \sum_{n=1}^\infty B_n\sin nx = \sin x$,
which requires $B_n=1$ and $n=1$ (only one term from the sum survives). The last condition yields
$u_t(x, 0) = \sum_{i=1}^\infty A_nn\sin nx = x^2$,
where the constant $A_n$ can be related to the coefficient in the sine series. We assume that $x\in[0, \pi]$, then
$A_n = \frac{2}{n\pi}\int_0^\pi dxx^2\sin nx$,
and the final solution reads
$u(x,t) = \sin x\cos t + \sum_{n=1}^\infty A_n\sin nx\sin nt$.
Hope this helps.