According to Healthline, the rectus femoris is the muscle that is used to extend the knee and flex the thigh. It is one of four quadriceps muscles on the front of the thigh.
Healthline explains that the other quadriceps muscles include the vastis lateralis, vastus medialis and vastus intermedius. The rectus femoris is located at the front of the thigh, running down the middle. It connects the hip to the patella, which is the bone commonly referred to as the knee cap. This is the only muscle that allows flexing of the hip. Injury typically occurs around the origin of the muscle near the hips and is often caused by common leg motions such as kicking or running.