If there is an Apple Store or Apple Aurhorized repair center near you, you have AppleCare. Bring your iMac in for diagnosis and repair.
Consider budgeting for and purchasing and registering for 3--year extended AppleCare warranty.
You will need it! This won't be your only issue with your iMac.