Installing hard drives in an iMac requires disassembling the machine and should be attempted only if you have experience. Following is a chart of all iMacs and their RAM module types and capacities.
There is no need to match all four modules of memory in a 4-slot iMac, you can have two pairs of different sizes. In iMacs, installing a single RAM is permissible, however installing a matching pair allows Dual Channel memory access, which has a small (6%-8%) but welcome real-world speed improvement. Different models of iMac have had either two RAM sockets or four RAM sockets. Apple has released a variety of iMac intel machines, which have used four different kinds of RAM.