Does the old saying “You can’t teach an old dog new tricks” have any basis in reality? Could you teach a 3 or 4 year old dog anything, housebreak them, basic commands? If not, how come?
Yes, a dog of just about any age can be taught nearly anything you want it to learn (except possibly calculus). Seriously, while housebreaking is a LOT more difficult with older dogs due to years of contrary habits, almost any dog will learn how to sit, lie down, shake hands, roll over, etc. if consistently provided with a pleasant reward for doing so. Food works well.
However, puppyhood is very important in shaping the personality of a dog, much like with human children. If the dog was raised in such a manner that it doesn’t care to please you (it can just run off and make its own reward, for example), it’ll be a lot more difficult. For example, you might not be able to make that severely abused old fighting dog your snuggle-buddy.
Also some dogs are more difficult to train for different reasons (some breeds are considered “smart” breeds, while others are not so "smart), but nearly all can be trained with the proper patience and skill (it may take a professional).
I’ve had a Lab, a Rottweiler, a pitt bull, and a Weimaraner (not all at the same time)–the Lab was eeeeasy to teach at any age. The Rott was pretty easy, too. The pitt was resistant to training, but a big lapdog sweetheart. She could learn some stuff, but not very reliably–but I’m not really a good trainer. My Weimaraner is smart as hell, but difficult (due to a super-high energy level).
All breeds have the same potential for intelligence; the same cannot be said, however, about all individual dogs.
Any but the stupidest dog can be taught new concepts (i.e., tricks) at any age.