I'd like you to explain to me the use of the gerund in the following two sentences.I included other sentences I'm not sure of.

1) One day, Prospero's frieds are having a party. They only stop when the pendulum is striking the hour.
2 The protagonist is thrown into a dark dungeon. He explores it and finds out that its shape is square and has a deep pit in the middle. The wall is covered with iron and with horrible figures.
3) Can you say "The protagonist is on the brink of a pit?"
4) At midnight a strange man with (or in??) a red costume and a death mask turns up and scares everybody.

1) In the first sentence, the gerund is "having." The use of the gerund here indicates an ongoing action or activity. In this case, it suggests that Prospero's friends are in the process of having a party.

To find the gerund in a sentence, look for a verb that ends in "-ing" and functions as a noun. In this case, "having" is the gerund because it serves as the object of the sentence.

2) In the second sentence, there are no gerunds present. However, there is a verb phrase ("is thrown") followed by a prepositional phrase ("into a dark dungeon") and an independent clause ("He explores it and finds out..."). The absence of gerunds in this sentence does not affect its overall meaning or structure.

3) Yes, you can say "The protagonist is on the brink of a pit." In this sentence, "is" is the helping verb, "on" is the preposition, and "brink" is the noun. Similarly, "of a pit" functions as a prepositional phrase that modifies the noun "brink."

4) In the fourth sentence, the gerund is "scaring." The use of the gerund indicates an ongoing action or activity. It suggests that the strange man is continuously scaring everybody.

Again, to identify the gerund in the sentence, look for a verb ending in "-ing" that functions as a noun. In this case, "scaring" is the gerund because it serves as the object of the preposition "and" and describes the action being performed by the strange man.