Subjects and first auxiliary verbs are inverted when asking certain types of questions in English. It occurs in questions with a yes or no answer and when the question begins with a question word.
An example of subject and verb inversion in a yes or no question can begin with the statement "John has done his homework." To change the statement to a question, it is modified to "Has John done his homework?" The same switch begins when a question word, also called an interrogative verb, starts off the question. Using the same statement about John, a question with an interrogative verb would be "What has John done?" Most question words begin with the letters wh-, with the word "how" being the lone exception.
Although subject and verb inversion most commonly occurs in questions, it can also occur in statements. Negative inversion occurs when a phrase at the beginning of the statement negates the rest, such as "At no time did John do his homework." It also occurs in subordinate clauses, such as "Had John done his homework," followed by a main clause. Elliptical sentences can also use this inversion. For example, "John did his homework, as did Kathy" contains an inversion in the second part of the statement.