An antagonist is a kind of muscle that acts in opposition to the movement generated by the agonist and is responsible for returning a limb to its initial position.
Antagonistic muscles are found in pairs called antagonistic pairs. These consist of an extensor muscle, which "opens" the joint (i.e. increasing the angle between the two bones), and a flexor muscle, which does the opposite to an extensor muscle.
Antagonistic pairs are needed in the body because muscles can only exert a pulling force, and can't push themselves back into their original positions. An example of this kind of muscle pairing is the biceps and triceps.
When the biceps are contracting, the triceps are relaxed, and are able to be stretched back to its original position. This is the opposite when the triceps are contracting.
When you stand up from a sitting position, both the hamstrings and quadriceps contract at the same time.
The Rectus Femoris biarticular muscle acting over the hip, when compared to the hamstrings has a smaller hip movement arm. But, the rectus femoris movement arm is greater over the knee, than the hamstring's knee movement. This means that contraction from both rectus femoris and hamstrings will result in hip extension, and knee extension. Hip extension will also add a passive stretch component to the Rectus Femoris, and will result in a knee extension force. This "paradox" allows for efficient movement especially during gait.[1]