No mathematical formula is given.
(a) 6 oz of yogurt is about 170 grams. As there is no fat, the 5 grams of protein account for 5*4 = 20 calories. The remaining 80 - 20 = 60 calories probably come from sugar (lactose). The total of 80 calories accounts for 80/4 = 20 grams of the weight. The remaining weight is likely mostly water.
(b) 2 oz of low-fat cottage cheese is about 56.7 grams. The 4.5 g of fat accounts for 4.5*9 = 40.5 calories. The 12 g of protein accounts for another 12*4 = 48 calories, for a total of 88.5 calories in the product. (Apparently, only calories from fat are reported in the 40 calories claimed.)
(c) 2 oz of ham is about 56.7 grams. 1 gram of fat accounts for 1*9 = 9 calories, and 5 g of protein accounts for 5*4 = 20 calories, for a total of 9 + 20 = 29 calories. This closely matches the 30 calories claimed for the product.
The number of grams of product depends on whether the product is measured in fluid ounces (volume) or ounces of weight. "1/4 cup" is a volume measure equal to 2 fluid ounces, different from 2 oz weight by roughly 2.5 grams for products with a density near 1.
(a) 6 oz of yogurt is about 170 grams. As there is no fat, the 5 grams of protein account for 5*4 = 20 calories. The remaining 80 - 20 = 60 calories probably come from sugar (lactose). The total of 80 calories accounts for 80/4 = 20 grams of the weight. The remaining weight is likely mostly water.
(b) 2 oz of low-fat cottage cheese is about 56.7 grams. The 4.5 g of fat accounts for 4.5*9 = 40.5 calories. The 12 g of protein accounts for another 12*4 = 48 calories, for a total of 88.5 calories in the product. (Apparently, only calories from fat are reported in the 40 calories claimed.)
(c) 2 oz of ham is about 56.7 grams. 1 gram of fat accounts for 1*9 = 9 calories, and 5 g of protein accounts for 5*4 = 20 calories, for a total of 9 + 20 = 29 calories. This closely matches the 30 calories claimed for the product.
The number of grams of product depends on whether the product is measured in fluid ounces (volume) or ounces of weight. "1/4 cup" is a volume measure equal to 2 fluid ounces, different from 2 oz weight by roughly 2.5 grams for products with a density near 1.