See A-Z of rehabilitation exercises
In case you cannot see the video, here is a still sequence -

Lie on your side on a firm surface with your head supported by your hand. Use a pillow for comfort if necessary.

Keeping your feet touching, widen the space between your knees. Holding the top leg in that position a few seconds....

...lower the knee to close the gap again. Repeat this 5 times. Roll over and repeat the sequence with your other leg.