The given name (or 'first' name) is sometimes, but not always, determined by the following pattern:
1st son = Father's father's name
2nd son = Mother's father
3rd son = Father
4th son = Father's grandfather
5th son = Mother's grandfather
1st daughter = Father's mother's name
2nd daughter = Mother's mother
3rd daughter = Mother
4th daughter = Father's grandmother
5th daughter = Mother's grandmother
To arrive at the last name, for the male children, 'son' was added to the father's first name. For the female children, 'datter' was added. For example, in the Jordal family, Ole Larson had a son Lars, who then became Lars Oleson. Ole's daughter, Torbjor became Torbjor Olsdatter (or Olsdatr).
For those families that lived on farms, the farm had a name which was used by the family as a second last name. If the family moved, their last name would change to match that of their new residence.
For more information on the Norwegian naming system, the following website provides more detail: