Don't forget goldfish should have a diet consisting of mostly vegetable matter. Too much protein in their diet can lead to even more problems down the line. Unfortunately, goldfish usually eat whatever they can put in their mouths so it's kinda up to us to make sure they eat what they're supposed to. I actually buy quality goldfish flakes and spirulina algae flakes and then make my own mix of 50/50. I would also recommend letting the flakes soak for a minute or two so it sinks instantly and they don't digest too much air...as someone posted earlier that too much air can lead to bladder disease. Not fun. Also, goldfish love frozen peas.
I actually have kept 2 fancy goldfish in a 46g tank with two filters, a marineland biowheel and an aquaclear. I also change 50% of the water every week. You might also want to try some live plants, as they will eat the nitrate abundance you'll have in a smaller tank. I know goldfish eat plants like crazy, but the trick is to get thick plants such as anubias. Pretty much any of the larger anubias and swords will do the trick. I know my goldfish love to eat the swords anyway, but I bought the biggest swords I could find and usually they replace their leaves fairly quickly. The nice thing about these two types of plants is that they require very little light. Some might disagree about the swords, but they grow for me just fine in a little over 1w/g of light. Stay away from anacharis, they'll be gone in less than a week. Also, jungle vals are pretty good, especially established ones, but they'll require a little extra light.
In my opinion you can keep 3 fancies in as little as 40g. They might be a little cramped, but they will grow fine. It just means YOU have to be very disciplined about your care. With good filtration, perhaps some ammonia chips as filter media, weekly 50% water changes, high quality food consisting mainly of vegetable matter, and some live plants I think you'll have a lot of success.
Also, when doing water changes, try to keep the currents away from them as sudden currents and added pressure can also affect their gall bladders. Sensitive little guys, I know. Slow and easy when you're filling back up, especially since you'll be doing it more often than necessary for a larger tank.
I once went into someone's house and they had a 10g tank with 2 goldfish!!! I tried to somehow let them know they're making them suffer without sounding pretentious. They told me those same two fish have been in there for 16 years! I was amazed. I asked how often they cleaned the water, they said twice a week.
Larger tank, less maintenance...smaller tank, more work.
Simple as that... and of course giving them plenty of swimming room also helps. Cuz regardless, I still believe that must have been 16 years of hell for those fish all cramped in a 10g.
Sorry for the ramble...