No, goldfish do not need to be in pairs. Goldfish can live alone with no problem. In the wild, goldfish tend to live alone, and because they’re not schooling fish either, you don’t need to keep them in pairs.
Even though they don’t need any companions to stay happy, your goldfish might appreciate having some tank mates. Just make sure the taken isn’t overcrowded as it can cause stress. You can keep 3–4 small goldfish in a 40-gallon tank.
Alternatively, you can also keep your goldfish with other friendly fish or aquatic creatures, such as: