You fill up the 3 gallon container and pour the 3 gallons into the 5 gallon container. You fill the 3 gallon container back up, and pour it into the 5 gallon container. You empty the 5 gallon container and pour the 1 gallon left in the 3 gallon container into the five gallon container. Then you fill the 3 gallon container back up and pour it into the 5 gallon container and you have 4 gallons.
Our adult riddles may be a little over the heads of the kids. Some have knowledge that you have to have been around a bit to understand, others may have content that is target for the adult mind. If you are a kid, head over to the kids riddles section or even the difficult riddles or math riddles to challenge your young brain.