You first need to prove [x , pn] = niħpn-1.
In order to do that take arbitrary values of n=1, 2, 3 and check.
You'll see for n=1 [x , p] = iħ result holds (as it is given and also we know)
for n=2 [x , p] = p[x , p] +[x , p]p = piħ +ipħ = 2ipħ = 2iħp2-1 again result holds
Similarly you can show for n=3 with the help of first two.
Now, assume for n=k this will hold i.e. [x , pk] = kiħpk-1
then show for n=k+1 and you will find [x , pk+1] = [x , pk]p + pk[x , p] = kihpk-1p + pkih
= kiħpk + kiħpk = (k+1)iħpk = (k+1)iħp(k+1)-1 again holds.
So, [x , pn] = niħpn-1 (PROVED)
Now, to evaluate [x , sin(p)], first expand sin(p) in taylor series.
You'll get sin(p) = p - (p3)/3! + (p5)/5! - ...
Put this in [x , sin(p)]
You'll get [x , sin(p)] = [x , p - (p3)/3! + (p5)/5! - ...]
= [x , p] - (1/3!)[x , p3] + (1/5!)[x , p5] - ...
= iħ - (1/3!)3iħp2 + (1/5!)5iħp4 - ...
= iħ [1 - p2/2! + p4/4! - ...]
= iħ cos(p)
∴ [x , sin(p)] = iħ cos(p)
And this is how you may do it.