Hi creolejazz,
The rule you search lies, I think, in the grammatical unit called "Nominal Clauses/ Nominal-ing clauses, that is, participle clauses", or as pieanne illustrated above, gerunds.
The commomest type of participle clause is that which has no subject.
When a is subject...