Ubuntu only detects 3.1 GB of ram on Ubuntu 64 bit

About 80% of CPUs in use nowadays (and almost every single new CPU sold) support 64-bit Ubuntu, so this doesn't come as a surprise. There are plans to suggest 64-bit Ubuntu as the default (the way 32-bit is suggested now) as most people's hardware is capable of running it.

Still, to see the total memory as seen by the kernel, as well as a report on how it's initially allocated, you can do this:

dmesg |grep "Memory: "

This will show a line such as this one:

[    0.000000] Memory: 3823988k/4849664k available (6109k kernel code, 874468k absent, 151208k reserved, 4876k data, 984k init)

My system has 4GB of RAM installed, however the total reported is something like 4.7 GB (I'm guessing the BIOS reports more memory due to address space for the video cards, PCI and IO devices and others). In the end only 3.6 GB are available to applications due to these concerns.

Note the "absent" memory amount, this "reflects the memory addressing space lost due to memory holes in the memory map. Typically holes are left for PCI space, IO, etc.. Every vendor model system is different, and every system will have a different value reported for the absent memory."

Also look at the question pointed to by fossfreedom, it gives you some more of an explanation of where addressing space may be being used.