Let x ml be the amount of the other coffee that costs P15.
If 40 ml of the shop’s coffee costs P30, then 4 ml costs P3. If we take a fixed amount of money, P75, we can buy 100 ml of the shop’s coffee (25 times 4 ml because P75 is 25 times P3).
For the same cost we can buy 5x ml of the other coffee (because P75 is 5 times P15).
The mixture contains x+40 ml of coffee and for P75 we can buy 3(x+40) ml (because P75 is 3 times P25, the cost of the mixture).
So, we can equate these: 100+5x=3(x+40)=3x+120 ml for P75.
100+5x=3x+120, 2x=120-100=20 ml so x=10 ml.
Therefore we need 10 ml of the other coffee to get the mixture at a cost of P25.
By the way, 75 is the LCM of 3, 15 and 25.
QUICK CHECK
100ml for P75⇒40ml for 40/100×75=P30
50ml for P75⇒10ml for 10/50×75=P15
150ml for P75⇒50ml for 50/150×75=P25