Let $G$ be a PRG. Are the following $G'$ constructions based on $G$ necessarily PRGs? $G$ is a PRG where $|G(s)| &gt; 2 \cdot |s|$.


$G'(s) = G(s0^{|s|})$.
$G'(s) = G(s_1...s_{n/2})$, where $s = s_1...s_n$.


My question here is whether my own proposed solutions are correct and do make sense.
Looks good to me! My intuition is that the PRG property means "random in, random out".

In 1. the input is not random so we get no guarantees - indeed, formally one could take any PRG H with 2s-bit inputs  and then define G to be H except on strings where the last s bits are 0, in which case G outputs the all-zero string. Now G is still a PRG, because the probability of hitting one of those modified points is at most $2^{-s}$ which makes a negligible difference overall. But $G'$ is now the function that always outputs the all-zero string.

What I've added here is the step from the intuition to a formal proof: I've given a case where $G$ is provably a PRG (ok, I didn't prove it here, but that's an easy exercise) and $G'$ is provably not a PRG.

In 2. if $s_1 \ldots s_n$ is uniform in $\{0,1\}^n$ then $s_1 \ldots s_{n/2}$ is certainly uniform in $\{0,1\}^{n/2}$. So applying $G$ to this string produces something uniformly distributed in the range of $G$, hence the whole thing is a PRG, just like you said.