It’s not easy to do the right thing.
What is the subject in the given sentence? I don’t think it’s obvious in this sentence. I was taught that subject is something, that performs the verb. But I don’t anything in this sentence that performs the verb.
Any help would be appreciated.
It is the subject. It’s known as a dummy subject, which means that it fulfills the syntactic requirement for a subject without supplying any explicit meaning. This usage appears fairly common when describing events like the weather:
It is raining.
It’s cold outside.
In your case, the sentence with it is an example of extraposition, meaning that it stands in for another subject that appears elsewhere in the sentence. An alternative version would put the infinitive clause at the start of the sentence:
To do the right thing is not easy.
It provides an alternative arrangement that brings the main verb closer to the start of the sentence, especially if the infinitive clause or other subordinate clause is longer:
It is not easy to do the right thing.