Let the number of students be x and the number of rows be y. Then,Number of students in each row =xy
When one student is extra in each row, there are 2 rows less i.e., when each row has (xy+1) students, the number of rows will be (y−2).
∴ Total number of students = No. of rows ×No. of students in each row
x=(xy+1)(y−2)
x=x−2xy+y−2
−2xy+y−2=0…(1)
If one student is less in each row, then there are 3 rows more i.e., when each row has (xy−1) students, the number of rows will be (y+3).
∴ Total number of students = No. of rows × No. of students in each row
⇒x=(xy−1)(y+3)
x=x+3xy−y−3
3xy−y−3=0…(2)
Putting xy=u in (1) and (2), we get:
−2u+y−2=0…(3)
3u−y−3=0…(4)
Adding (3) and (4), we get:
u−5=0
⇒u=5
Putting u=5 in (3), we get y=12
Now, u=5
xy=5
x12=5
x=60
Hence, the number of students in the class is 60.