The hip joint is basically a ball and socket joint. That means the femur can rotate, swing back and forwards and outwards and inwards relative to the pelvis. That being said, the main directions that the femur tends to move in, relative to the hip bone, are forwards and backwards.
Because the hip tends to move in a forward and backwards direction, one way to visualize the muscles of the hip is similiar to the arrangement of spokes of a bicycle wheel.
(The wheels, on either side of the hip, face forwards.)
If we do liken the hip joint to a bicycle wheel, the muscles of the hip joint would be the rough equivalent of spokes. The hip bone could be the rim of the wheel and the femur could be the hub.
With balanced tension in the muscles, the head of the femur can be kept centered with respect to the socket of the hip.
If you've ever played with the spokes of a bicycle wheel, you know that they are fairly strongly tensioned. As a result, the hub is pretty rigidly stabilized relative to the rim.
Generally, the muscles of the hip aren't tensioned to the point of rigidity. Instead we have tension on demand that can be created by hip muscles.
Because our hip muscles aren't always tensioned, at least not to the degree of a bicycle wheel, we have the option, when the hip muscles are relaxed, of allowing our femur to move freely relative to the hip bone or vice versa.
If we are standing on one leg, while bearing additional weight, if the hip muscles of the standing leg are relaxed, then the the top of the hip socket could sink down and rest on the top of the ball of the femur.
This is a bad thing. Think of it as the rough equivalent of a car's suspension bottoming out.
However, if particular hip muscles are activated, then they can act to prevent the top of the hip socket from resting on the top of the ball of the hip joint.
Keeping the hip joint centered is a balancing act.
Muscles can work against each other or against external forces (or against body weight) to help keep a hip joint centered.
Two hip muscles that could be paired are the iliacus and the obturator internus. One reason I would suggest that these muscles are "functional opposites" or "compliments" is that they both cover a large portion of the inner surface of each hip bone.
These muscles both wrap around the pelvis before attaching to the thigh bone and both attach to the inner surface of the thigh bone close to the hip socket.
The obturator internus covers a large portion of the lower rear inner surface of the hip bone. It wraps around the back of the pelvis at the lower sciatic notch and from there runs slightly upwards to attach to the inner surface of the greater trochanter.
In contrast the iliacus covers a large portion of the lower forward inner surface of the hip bone. It wraps around the front of the pelvis at the span of bone between the pubic bone and hip socket and from there passes down and back to attach to the lesser trochanter, on the inner surface of the shaft of the thigh bone which is just below the neck of the thigh bone.
From the pictures below you can see how these two muscles could be thought of as directly opposing "spokes".
Note that the obturator internus, when active, may cause the sitting bones to flare or protract slightly. Meanwhile the iliacus may cause the upper front of the pelvis to widen or flare. This assumes that the thigh bones are stable.
Muscles with similiar lines of action are the pectineus and the gemellus superior and inferior.
The pectineus runs from near the pubis, to the lesser trochanter and so has a similiar line of pull to the iliacus.
The gemellus superior and gemellus inferior connect above and below the lesser sciatic notch and attach to the thigh bone at the same point as the obturator internus.
Another set of muscles that share similiar points of attachment to the thigh bone include the piriformis and the psoas.
The psoas attaches to the vertebrae of the lumbar spine and like the iliacus wraps around the front of the pelvis to attach to the lesser trochanter.
The piriformis attaches to the front of the sacrum and passes through the upper sciatic notch to attach to the thigh near the same place as the obturator internus and the gemelli muscles.
Because the hip muscles need to be able to support the hip joint through a range of possible movements I'd suggest that the obturator externus may share a similiar job to the psoas/iliacus/pectineus set.
The obturator externus attaches to the side of the pelvis below the hip socket and wraps under the neck of the thigh bone to attach to the inner surface of the greater trochanter.
The quadratus femoris may share or substitute for the obturator internus/gemelli/piriformis group.
The quadratus femoris attaches towards the bottom rear of the pelvis, above the sitting bone and from there attaches to the rear of the thigh bone. This may be particularly true in a "bent forwards" (or flexed) position.
The Glute Maximus should be mentioned here because it opposes the psoas in a couple of ways. The gluteus is massive enough that in a standing position it can be contracted in such a way to push the pelvis forwards. The psoas, because of the way it folds around the front of the pelvis can be used to push the hips back. Both actions can have a momentus (filled with momentum) feel to them.
The gluteus maximus attaches to the back of the sacrum, the sacrotuberous ligament, and portions of the rear of the pelvis. From there it has fibers that attach to the rear of the thigh. It also has fibers that act on the iliotibial band but we'll discount those for now.
The following group of hip muscle could be thought of as creating space in the hip joint. They don't really create space in the hip joint, though it can be a useful way to think of them. Instead they simply help to keep the head of the femur centered in the hip socket.
When we are standing upright, they can activate and work against the weight of the body to prevent it from resting on top of the ball of the hip joint.
Gemelli means twins and the gemellus inferior and superior are like twins both above and below the obturator internus muscle.
These muscles originate just above the sitting bone and reach forward and up (and outwards) to attach to the top of the thigh bone.
The gap between where they originate both is called the "lesser sciatic notch." The obturator internus passes through this notch. Meanwhile the gap in the pelvis above this is called the "greater sciatic notch." (The piriformis passes through this notch.)
Openings in the body are called Foramen. Each hip bone has an opening that looks like an eye hole when the hip bone is viewed from the front. This opening is referred to as a foramen.
An obturator is a soft structure that closes off a foramen. Both the obturator internus and externus muscles attach to connective tissue that covers the foramen of the hip bone. And so the obturator externus covers the opening of the hip bone from the outside while the obturator internus covers this opening from the inside.
The obturator internus is located within the pelvis, exiting the back of the pelvis. The obturator externus runs along the outside of the lower pelvis.
If you look at a picture of the side view of a pelvis without the thigh bone it can be easy to confuse the hip socket and the obturator foramen. The obturator foramen is located below the hip socket (acetabulum.)
The internal obturator covers the inside of the obturator foramen. It wraps around the back of the pelvis and then passes through the lower sciatic notch between the gemelli. It blends with the gemelli to attach to the top of the thigh bone.
(Note that the internal obturator covers a large portion of the inside of the pelvis.)
The external obturator covers the outside of the obturator foramen. It hooks back and up passing under and behind the neck of the thigh bone to attach to the back of the femur.
All of these muscles (gemellii and obturators both) pass upwards from the pelvis to the thigh bone and can be thought of as lower spokes on the wheel of the hip joint.
From a back view (or front view) of the pelvis, these muscles pass outwards and upwards to the thigh. Because of this they can be used to pull the pelvis upwards relative to the thigh bone.
And that was the point of mentioning the importance of the lower spokes of a bicycle wheel.
While for now I'm refering to the pelvis in an upright position, it might be helpful to understand that just as a wheel can function in any orientation (it can roll) so too can the pelvis.
Note that while the "hip openers" can work against gravity to keep the hip joint centered while the body is upright, the body needs muscles to oppose these muscles when gravity or other external forces aren't a consideration.
Hip muscles that might oppose or counterbalance the tension created by the obturators and gemelli are the gluteal muscles, in particular gluteus minimus and medius.
These muscles attach to the side of the "blade" of the pelvis (ilium) and from there extend down to attach to the external surface of the greater trochanter, the protrusion of the thigh that you can generally feel just below the hip crest.
The attachments of the gluteals, obturators and gemelli have some overlap, just like the spokes of a wheel.
This overlapping helps these muscles to stabilize the hip (in the same way that spokes on a bicycle wheel overlap for stability).
Gluteus Medius has more "bulk" towards the back of the side of the pelvis. It tends to originate higher up on the side of the pelvis than the gluteus minimus muscle. It attaches towards the back of the greater trochanter of the femur.
The obturators both attach to the inner aspect of the thigh bone, but at the back and top. The internus wraps around the pelvis while the externus wraps under the neck of the thigh bone.
Another single joint muscle of the hip that wraps around the pelvis to attach to the thigh is the iliacus.
This muscle attaches lower to the inside of the thigh bone (to the lesser trochanter, the little bump of bone that sticks out towards the back of the thigh.)
Note that the illiacus and obturator internus both cover a large portion of the inner surface of the pelvis. This may give them both "better grip." Also because they fold around the pelvis to attach to the thigh, this fold may create a pulley affect, giving these muscles extra leverage.
Because of their angle of attachment to the femur, the iliacus and obturator internus (and externus) could be thought of as "hip flexors."
They tend to tilt the pelvis forwards relative to the thigh bone.
It may be that because of the way the spine is at the back of the body, when standing our upper body exerts a downward pressure on the back of the pelvis. These muscles can help to resist that downward pressure.
In a similar vein it may be that while standing on one leg the natural tendency is for the non weighted side of the pelvis to move forwards (causing internal rotation on the standing leg side.)
And so most of the single joint muslces of the hip help to oppose this action, using external rotation to resist the natural tendency of the pelvis to "internally rotate."
The pectineus and quadratus femoris work from opposite sides of the pelvis. Pectineus angles back and down front the front of the pelvis attaching to the inner part of the thigh bone.
Quadratus femoris angles forwards and down from just in front of the sitting bones, but also to the inside of the back of the thigh.
These muscles can help to stabilize the "forward/backward" tilt of the pelvis (or fine tune it.)
All of the muscles that have been mentioned so far attach between the pelvis proper and the thigh bone. They act like the spokes of the wheel to control the relationship between pelvis and thigh.
The next set of muscles are multijoint muscles.
The piriformis attaches to the sacrum and cross the SI Joint to attach to the inner surface of the greater trochanter (close to where the gemelli and obturator internus attach.) While the SI Joint doesn't have a lot of movement, it does allow the pelvis to "flex" or change shape. And so changes in shape of the pelvis may affect the piriformis. What may happen is that changes in tension in the connective tissue that connects the sacrum to the pelvis acts as a signalling mechanism, helping to tell the piriformis when to activate and when to relax.
The psoas muscle attaches the lumbar vertebrae. It's fibers reach down towards the front of the pelvis, on either side of the pubic bone. They pass underneath the inguinal ligament (the line that separates your belly from your thighs) and from there reach back to attach to the inner thigh at the lesser trochanter.
This muscle is affected by changes in angle between the pelvis and thigh bone. But it is also affected by sideways bending, front or back bending and even twisting of the lumbar spine. With respect to the psoas I often think of the lumbar spine as a tensioning device for the psoas. To this end, if balancing on one leg and lifting one knee then I allow my tailbone to drop, my pelvis to tilt backwards and my lumbar spine to curve forwards (so that the back of the lumbar spine is more "open" than the front) so that the psoas has "more room" to contract and lift the thigh.
The gluteus maximus is actually a complex muscle. It has attachments to the back of the sacrum, as well as to the back and rear of the pelvis and it also attaches to connective tissue covering the gluteus medius. At the other end it attaches to the back of the thigh bone close to the top. But it also attaches to the Fascia Latae, a band of connective tissue which connects to the top of the outside of the fibula, the smaller of the two lower leg bones.
I've yet to find an anatomy book or reference that clearly delineates which fibers attach where, but it may be that the fibers that attach to the pelvis and to the outside of the gluteus medius are the ones that also attach to the Fascae Latae while the fibers that attach mainly to the sacrum are the ones that also attach to the back of the thigh.
For this reason it could be helpful to think of the gluteus maximus as two separate muscles, one that works on the lower leg bone and one that works directly on the thigh.
A big deal used to be made about how the gluteus maximus is an external rotator of the hip, which it is. But it is also the major hip extensor. And I'd suggest that it is actually pretty easy to learn to activate the glute max in such a way that it causes external rotation and also to activate it in such a way that it extends the hip without externally rotating the thigh.
Obviously... or not so obviously, other hip muscles will come into play to help neutralize the external rotation component, or it may be that there are fibers that are more apt to cause external rotation, and those fibers can be "turned of" when "pure" hip extension is intended.
The adductors include the adductor brevis, longus, and magnus. (I've already mentioned pectineus and obturator externus.)
Adduct means "pull inwards" or towards the centerline.
Where the glutes attach to the blade of the pelvis from front to back, and while the iliacus and obturator internus cover a large portion of the inner surface of the pelvis, the adductor magnus attaches to the most of the length of the ischio pubo ramus.
You can think of the ischio-pubo ramus as the "rockers" of the pelvis.
The fibers of adductor magnus that attach towards the front of the ischio puboramus attach higher up on the thigh. The fibers that attach towards the back of the ischio pubo ramus attach lower down on the thigh.
Adductor Brevis attaches towards the front of the ischio pubo ramus. It also attaches to a short portion of the upper thigh.
Adductor Longus attaches even further forwards but attaches lower on the thigh.
The knee affects the hip and vice versa. I've recently experienced this first hand getting over some knee problems. One way to think of the hamstrings is that with the knees straight the hamstrings have some "pre tension" making it easier for them to be used in extending the hip. If the pelvis is tilted forwards, opening the back of the hip joint, then this can add tension to the hamstrings even if the knees are bent.
I go over the hamstrings (and how they interact with the glutes) in more detail in hamstring anatomy.
The Sartorius, Gracilis and Semitendinosus all attach to the inside of the tibia just below the knee joint. They pass behind the thigh bone and then extend up the thigh to attach to the sitting bone (semi-tendinosus, which is also a "hamstring muscle") the pubic bone (gracilis) and the front peak of the pelvis or ASIC (the sartorius.)
My impression of these muscles is that with the knee straight they help to create a forward push on the bottom of the inner thigh bone while at the same time pulling backwards on the top of the inner tibia. This could be a way of stabilizing the knee. Rather than acting together, these muscles may be positioned so that no matter what position the pelvis is in, it is possible to "stabilize the knee." With the knee bent any of these muscles could be used to rotate the shin internally relative to the thigh.
In a standing position with the lower leg stable these muscles may also be used to help stabilize the pelvis, creating a downward pull on the sitting bone, pubic bone and ASIC.
Note while the focus here is on the hip joint, I'd suggest that if you have painful knees, you may find it helpful while sitting to pull up and back on the ASICs. In my limited experience, this activate the external obliques, which then may give the sartorius a stable foundation from which to contract to help stabilize the knee. I found that when my knee was newly injured, it seemed to go out of joint when standing after a long period of sitting. If I pulled up and back on the ASICs while sitting, I seemed to be able to avoid this problem.
I'd suggest that while controlling the hip muscles in isolation is a helpful exercise, particularly when you are trying to figure out problems with your hips, (and I go over some simple isolation exercises in the hip control guide) another approach is simply to "balance tension" in and around the hip joint.
For hip control with respect to improving hip joint flexiblity in forward bends and backward bends, I've included step by step exercises in Active Stretching.