This absolutely is possible, what you are trying to do here is add product variants. This allows you to add different options to a product, in your case different size products. Once you create a product variant, you can set a unique price for that variant.
If that was a little confusing, don't worry! There is a shopify manual that can help walk you through the whole process of adding and editing product variants, you can find that