Answer
Please see the work below.
Work Step by Step
We can generate a longitudinal wave by hitting the nail on its head parallel to its length. On the other hand, to generate a transverse wave we need to hit the nail perpendicular to its length.