No. memory is the amunt installed, and 2GB is simply not enough.
Your next problem is with only 34GB free on your hard drive, you should be having slow down, beach balls etc. Most recommend a minimum of 20% free space for a hard drive to work anywhere near efficiently so you have a lot of clering out of old files to do, or remove iTunes, Photos etc to an external drive.
Yosemite is free so that is even cheaper than $20.00.
You still need to provide the model of your iMac so we can ascertain if Yosemite will actually run on the machine. As a rule of thumb 2008 models will run Yosemite, early models no.