Knees are complicated joints. They consist of the femur (thigh bone), tibia and fibula (calf bones), meniscus (cushion between those bones), patella (knee cap), seven ligaments (connecting bones to other bones), and cartilage. The muscles that attach at the knee are the quadriceps (front of thigh), hamstrings (back of thigh), sartorius (wraps around the front of the thigh), gracillis (inner thigh), and a half dozen muscles in the calf. There's also an iliotibial band that runs along the outside of the thigh. Problems with any of these can cause knee pain.
Ligaments, that hold bone to bone, are small and require the support of surrounding muscles to maintain the strength of the joint. If the muscles around them are weak, the ligaments are left to do the job of supporting the knee. They are simply not strong enough to do this, so become easily injured.
The stronger the leg muscles are, the less work the ligaments in the knee have to do, so strengthening those muscles is important. Evenly strengthening the front, backs, inner and outer leg muscles is important because muscle imbalance is one common cause of knee pain. If a muscle in the knee is tighter or weaker than the others, the bones can be pulled out of proper alignment and create problems.
Hip or foot troubles, or an imbalance in them, can also create knee pain because your knee is affected by both. To prove it, turn your hip, and notice how your knee moves. Next, turn your foot and see how your knee moves.
Don't do the following, but if your hip moves one direction and your foot moves the opposite direction, your knee twists. This is not what knees are designed to do, and can cause injury. This is why it's important to always keep your hip, knee and foot pointing the same way, especially when putting weight on it.
To keep your knees healthy, balance strength with flexibility in all your leg muscles so they support the joint without pulling on it. Keep your feet and ankles strong and flexible by going barefoot every now and then, and balancing on each foot. Stretch and strengthen the muscles around the pelvis.
The more we know about anatomy, and the basics of keeping our bodies strong and flexible, the more apt we are to keep ourselves from injury.