When you separate variables, you are led to the equations
$ X''(x) = - \lambda X(x)$
$ T''(x) = - \lambda T(t)$
to be solved with some constant $\lambda$. Note that there is no restriction on the sign of $\lambda$. Any restriction must come from the problem itself, rather than being arbitrarily imposed by us. Then you solve the spatial part, and realize that there is no nontrivial solution if $\lambda<0$. The case $\lambda=0$ gives the solution $X(x)=1$, which leads to $T_0$. The last remaining case $\lambda>0$ implies the condition that $\lambda$ must be of the form $(n\pi)^2$, where $n$ is a positive integer. What you are doing in the last step is simply collecting all the solutions you obtained.
The TTU paper you linked to is somewhat incomplete. Perhaps you have to read that in light of the earlier notes in the series.
I admitted for the current stiff PDE education system, it is hard to find the examples of solving PDEs with sightly innovative types of conditions.
So it is the time to use the brains ourselves.
For your first example, it gives the message that the roles of $x$ and $t$ can be interchanged.
Please use the general solution of the form $u(x,t)=f\left(t+\dfrac{x}{2}\right)+g\left(t-\dfrac{x}{2}\right)+4t^2-x^2$ instead for convenience.
$u(0,t)=t$ :
$f(t)+g(t)+4t^2=t$
$f(t)+g(t)=t-4t^2~......(1)$
$u_x(x,t)=f_x\left(t+\dfrac{x}{2}\right)+g_x\left(t-\dfrac{x}{2}\right)-2x=\dfrac{1}{2}f_t\left(t+\dfrac{x}{2}\right)-\dfrac{1}{2}g_t\left(t-\dfrac{x}{2}\right)-2x$
$u_x(0,t)=0$ :
$\dfrac{1}{2}f_t(t)-\dfrac{1}{2}g_t(t)=0$
$f_t(t)-g_t(t)=0$
$f(t)-g(t)=c~......(2)$
$\therefore f(t)=\dfrac{t}{2}-2t^2+\dfrac{c}{2},g(t)=\dfrac{t}{2}-2t^2-\dfrac{c}{2}$
$\therefore u(x,t)=\dfrac{t}{2}+\dfrac{x}{4}-2\left(t+\dfrac{x}{2}\right)^2+\dfrac{c}{2}+\dfrac{t}{2}-\dfrac{x}{4}-2\left(t-\dfrac{x}{2}\right)^2-\dfrac{c}{2}+4t^2-x^2=t-2x^2$
For your second example,
Please use the general solution of the form $u(x,t)=f(2t+x)+g(2t-x)+\dfrac{t^2}{2}-\dfrac{x^2}{8}$ instead for convenience.
$u(x,x)=x^2$ :
$f(3x)+g(x)+\dfrac{x^2}{2}-\dfrac{x^2}{8}=x^2$
$f(3x)+g(x)=\dfrac{5x^2}{8}~......(1)$
$u_t(x,t)=f_t(2t+x)+g_t(2t-x)+t=2f_x(2t+x)+2g_x(2t-x)+t$
$u_t(x,x)=x$ :
$2f_x(3x)+2g_x(x)+x=x$
$3f_x(3x)+3g_x(x)=0$
$f(3x)+3g(x)=c~......(2)$
$\therefore f(x)=\dfrac{5x^2}{48}-\dfrac{c}{2},g(x)=\dfrac{c}{2}-\dfrac{5x^2}{16}$
$\therefore u(x,t)=\dfrac{5(2t+x)^2}{48}-\dfrac{c}{2}+\dfrac{c}{2}-\dfrac{5(2t-x)^2}{16}+\dfrac{t^2}{2}-\dfrac{x^2}{8}=-\dfrac{x^2-5xt+t^2}{3}$
Your two examples are having the conditions in same positions. Note that for the cases of having the conditions in different positions, their PDEs may still have infinitely many solutions.
For example $u_{tt}=u_{xx}$ with $u(x,0)=0$ and $u(0,t)=0$ ,
The general solution is $u(x,t)=f(x+t)+g(x-t)$
$u(x,0)=0$ :
$f(x)+g(x)=0~......(1)$
$u(0,t)=0$ :
$f(t)+g(-t)=0~......(2)$
$\therefore f(t)-f(-t)=0$
$f(t)=\Phi(t)$ , where $\Phi(t)$ is any even function of $t$
$\therefore g(x)=-\Phi(x)$ , where $\Phi(x)$ is any even function of $x$
$\therefore u(x,t)=\Phi(x+t)-\Phi(x-t)$ , where $\Phi(x)$ is any even function of $x$
Another good example is Does the wave equation require an initial function for one of its derivative?.
Best Answer
Assuming $u(t,x)=T(t)X(x)$, the separated equations are $$ \frac{T''}{c^2 T} = \lambda, \;\; \lambda = \frac{X''}{X}, \; X'(0)=X'(\pi)=0. $$ The $X$ solutions dictate the values of $\lambda$ to be $-n^2$ for $n=1,2,3,\cdots$, and the corresponding eigenfunctions are unique up to multiplicative constants, and are given by $$ X_n(x) = \cos(n x),\;\;\; n=0,1,2,3,\cdots. $$ The general solution is $$ u(x,t) = (A_0+B_0t)+\sum_{n=1}^{\infty}\left(A_n\cos(nc t)+B_n\sin(nc t)\right)\cos(n x). $$ The constants $A_n,B_n$ are determined by the initial conditions: $$ \cos(x) = u(x,0) = A_0+\sum_{n=1}^{\infty}A_n\cos(n x), \\ \cos^2(x) = u_{t}(x,0) = B_0+\sum_{n=1}^{\infty}nc B_n\cos(n x). $$ The mutual orthogonality of the functions $\{ \cos(n\pi x) \}_{n=0}^{\infty}$ in $L^2[0,\pi]$ is used to determine the coefficients $A_n$ and $B_n$ in the usual manner of Fourier, which is simplified after applying the identity $$ \cos^2(x) = \frac{1+\cos(2x)}{2}. $$