By is used as a preposition in a sentence to indicate proximity. It is used to indicate the person that does something in a passive voice sentence. It is also used to indicate an action with a particular purpose. It is also used to indicate a mean or method.