# Understanding TransformedDistribution behavior on two similar lines of code

The two following lines of code does not give the same output. Mathematica manages to calculate the first one but fails to calculate the second one.

PDF[TransformedDistribution[
a^2, {a \[Distributed] NormalDistribution[0, 1]}], x]

PDF[TransformedDistribution[
a*b, {a \[Distributed] NormalDistribution[0, 1],
b \[Distributed] NormalDistribution[0, 1]}], x]


Why is that?

The two are not equivalent. The first is a one-sided distribution (a^2 is nonnegative) whereas the second is two-sided (a*b is both positive and negative).

You can also generate the first from the HalfNormalDistribution:

Assuming[x > 0,
PDF[TransformedDistribution[
a^2, {a \[Distributed] NormalDistribution[0, 1]}], x] ==
PDF[TransformedDistribution[
a^2, {a \[Distributed] HalfNormalDistribution[Sqrt[Pi/2]]}], x] //
Simplify]


True