What is the difference between primary and secondary memory? Why do we need both in computers?

Primary memory (RAM, cache memory) is fast and temporary, used for processing tasks.

Secondary memory (hard drives, SSDs) is slower but permanent, used for storing data.
We need both because primary memory ensures fast processing, while secondary memory provides long-term data storage.