Help me understand how Pulse-Amplitude Modulation (PAM) works Reading on the Internet i learned that PAM is basically a sampling technique which converts an analog signal into a discrete signal. It modulates a train of pulses by varying the amplitudes of the individual pulses in a regularly timed sequence based on the analog wave. (Multiplying the analog signal with a train of pulses)



In my mind i have the idea of PAM being similar to AM but instead of an analog carrier we have a train of pulses.

On the other hand in some textbook i read that the way PAM works is by grouping bits from a stream into symbols and each symbol corresponds to a pulse with a certain amplitude. 



This seems to me as a completely different process than the first definition.
So what is true? and if both are true when is the second way to do PAM used?
If you define pulse amplitude modulation (PAM) as a method where a train of pulses is generated with the information coded by the amplitude of these pulses then both methods comply with that definition.

In analog PAM, the amplitudes are defined by samples of the analog source signal, whereas in digital PAM, the amplitudes are discrete and are defined by the bit pattern and some fixed mapping between bit patterns and discrete amplitude values.

In both cases, the PAM signal is given by

$$s(t)=\sum_kA_kp(t-kT)\tag{1}$$

where $A_k$ are the amplitudes representing the analog or digital source signal, $p(t)$ is the pulse, and $T$ is the symbol rate.

The signal $(1)$ is a baseband PAM signal, which can be modulated by a carrier to obtain passband PAM. Using complex symbols $A_k$ on a rectangular grid in the complex plane and two orthogonal carriers gives you quadrature amplitude modulation (QAM). Take a look at this answer for more information on passband PAM.