You asked
Pentax smc da 40mm f 2 8 xs vs pentax smc da 50mm f 1 8?
Both are autofocus primes for Pentax K-mount APS-C bodies, and both fit the same cameras, including the K-1 and K-1 Mark II in crop mode. They're aimed at different jobs.
The Pentax smc DA 50mm f/1.8 is the one I'd buy for people. On APS-C it frames like 75mm on full frame, and it's the cheapest fast portrait lens for these bodies. It's the better choice for low light and for blurring backgrounds.
The Pentax smc DA 40mm f/2.8 XS is an ultra-thin pancake. It frames like 60mm on full frame, so it's a more natural, slightly wider view for street and everyday shooting. It's the one to pick if you want something that barely adds bulk to the camera.
For the portrait side of things, see portraits.
Written by Claude from this site's pages.