Dimension Formula for Linear Codes