It happened at Pennridge High School in Perkasie, Pa.
The assignment focused on Maya Angelou and her autobiography "I Know Why the Caged Bird Sings."
Two of the questions were captured in a photograph sent to Action News from Pennridge Reform.
One provides an algebra formula that asked: "Angelou was sexually abused by her mother's ___ at age 8, which shaped her career choices and motivation for writing."
Pennridge High School students needed to solve the formula before deciding whether the answer was boyfriend, brother or father.
The next question reads: "Trying to support her son as a single mother, she worked as a pimp, prostitute and ___." Another formula must be solved to determine if the answer was bookie, drug dealer or nightclub dancer.
The homework was coupled with a word puzzle about the book and author, The Intelligencer newspaper reported Friday.
The assignment was from a website that allows teachers around the world to share resources. The teacher who distributed the homework has not been identified.
"We apologize to anyone who was offended by the content of the assignment and have taken steps to avoid such occurrences in the future," Pennridge Superintendent Jacqueline Rattigan said in a statement, adding the district had received complaints.
"Oh my God. I don't know man, I think if you are a teacher and you are pulling stuff off the internet that you should at least be reading through it yourself," said senior Jacob Smith.
Even in light of the assignment's relation to Angelou's work, some said it was still not appropriate for math class.
"I still think it is a problem," said Marie Seternus. "It shouldn't be on a math test."
A similar homework assignment caused controversy in Fort Myers, Florida, in 2015. In that case, a middle school teacher also downloaded the algebra homework from an external website. The district said the veteran teacher didn't carefully examine the homework and called it an oversight that wouldn't be repeated.
"I Know Why the Caged Bird Sings," published in 1969, is assigned reading in many high schools, but is also occasionally attacked for its content.
Angelou's passages about her rape and teen pregnancy have made it a perennial on the American Library Association's list of works that draw complaints from parents and educators.
"'I thought that it was a mild book. There's no profanity," Angelou, who died in 2014, told The Associated Press. "It speaks about surviving, and it really doesn't make ogres of many people. I was shocked to find there were people who really wanted it banned, and I still believe people who are against the book have never read the book."
The following is the complete statement issued by the Pennridge School District:
"We have received a number of complaints from parents and members of the community regarding a recent high school math homework assignment which contained adult content without a proper context. The homework worksheet in question was downloaded from a website that allows teachers around the world to share educational resources. It is not part of our approved curriculum. We apologize to anyone who was offended by the content of the assignment and have taken steps to avoid such occurrences in the future."
The Associated Press contributed to this report.