Solve this simultaneously.
Where a= apples and p= pears,
a+p=50 and 2a+3p=130
Multiply a+p=50 by 2 on both sides to get:
2a+2p=100
Then subtract the two equations from each other:
2a+3p=130
2a+2p=100
--------------- --> 2a-2a=0 ; 3p-2p=p ; 130-100=30
0+p=30
So p=30 (number of pears)
Which means that a is:
a+p=50 , where p=30
a+30=50
a=50-30=20 (number of apples)