Nobody said they do it for themselves only - although that is a good reason! Yes, we are influenced by the opinions around us, I doubt anyone is NOT.
BUT, you CANNOT rely on others opinions for your own self-worth. Beauty and what looks good is subjective, it differs for everyone. This is why I rely on my own strength and confidence to shape how I feel about me. My looks don't define me, they enhance me. I work out because it makes me feel good about how I look, and yes, even how I am perceived by others. But I also know that not everyone thinks I look good - and this is why I don't base my self-worth on what others think. If I were to base my entire mental/emotional being on others opinions, I wouldn't leave the house becasue the smallest critisism would destroy me.