Sitting correctly (erect) is very important for your posture and your back and neck.
The hamstrings play an important part of helping us to sit correctly.
They run from the back of your pelvic bone(posture thigh muscles) to just below the back of your knee. Their role is for bending the knee and assisting the gluteal muscles to extend the hip.
A good way to keep these muscles subtle and in good condition is to stretch them. Before doing any exercises if you have a bad back check with your GP first.
You can gently stretch them by lying on your back and grasping the leg behind the knee with your hip flexed to 90 degrees and the knee bent. Then try to straighten the knee for 30 seconds, with your toes pointed back towards you. Repeat, once or twice a day.
Another way is to sit with one leg bent and the other straight out in front of you. Rotate the straight leg inwards and lean forward at the hips to feel a stretch under the thighs. Hold for 30 seconds and repeat once or twice a day.