Look at the following figure. Find the pattern for writing a number in the small triangles and find the missing number.
(a) Look at the following matchstick pattern of squares. The squares are not separate. Two neighbouring squares have a common matchstick. Observe the patterns and find the rule that gives the number of matchsticks in terms of the number of squares. (Hint: if you remove the vertical stick at the end, you will get a pattern of Cs.)
(b) The given figure gives a matchstick pattern of triangles. Find the general rule that gives the number of matchsticks in terms of the number of triangles.