# 42.8 Image

`Image( map, elm )`

In this form `Image` returns the image of the element elm of the source of the mapping map under map, i.e., the element of the range to which map maps elm. Note that map must be a single valued mapping, a multi valued mapping is not allowed (see Images). This can also be expressed as `elm ^ map` (see Operations for Mappings).

```    gap> g := Group( (1,2,3,4), (2,4), (5,6,7) );;  g.name := "g";;
gap> p4 := MappingByFunction( g, g, x -> x^4 );
MappingByFunction( g, g, function ( x )
return x ^ 4;
end )
gap> Image( p4, (2,4)(5,6,7) );
(5,6,7)
gap> p5 := MappingByFunction( g, g, x -> x^5 );
MappingByFunction( g, g, function ( x )
return x ^ 5;
end )
gap> Image( p5, (2,4)(5,6,7) );
(2,4)(5,7,6) ```

`Image( map, elms )`

In this form `Image` returns the image of the set of elements elms of the source of the mapping map under map, i.e., set of images of the elements in elms. elms may be a proper set (see Sets) or a domain (see Domains). The result will be a subset of the range of map, either as a proper set or as a domain. Again map must be a single valued mapping, a multi valued mapping is not allowed (see Images).

```    gap> Image( p4, Subgroup( g, [ (2,4), (5,6,7) ] ) );
[ (), (5,6,7), (5,7,6) ]
gap> Image( p5, [ (5,6,7), (2,4) ] );
[ (5,7,6), (2,4) ] ```

Note that in the first example, the result is returned as a proper set, even though it is mathematically a subgroup. This is because `p4` is not known to be a homomorphism, even though it is one.

`Image( map )`

In this form `Image` returns the image of the mapping map, i.e., the subset of element of the range of map that are actually values of map. Note that in this case the argument may also be a multi valued mapping.

```    gap> Image( p4 );
[ (), (5,6,7), (5,7,6) ]
gap> Image( p5 ) = g;
true ```

`Image` firsts checks in which form it is called.

In the first case it calls `map.operations.ImageElm( map, elm )` and returns this value.

The default function called this way is `MappingOps.ImageElm`, which checks that map is indeed a single valued mapping, calls ```Images( map, elm )```, and returns the single element of the set returned by `Images`. Look in the index under Image to see for which mappings this function is overlaid.

In the second case it calls `map.operations.ImageSet( map, elms )` and returns this value.

The default function called this way is `MappingOps.ImageSet`, which checks that map is indeed a single valued mapping, calls ```Images( map, elms )```, and returns this value. Look in the index under Image to see for which mappings this function is overlaid.

In the third case it tests if the field `map.image` is bound. If this field is bound, it simply returns this value. Otherwise it calls `map.operations.ImageSource( map )`, remembers the returned value in `map.image`, and returns it.

The default function called this way is `MappingOps.ImageSource`, which calls `Images( map, map.source )`, and returns this value. This function is seldom overlaid, since all the work is done by `map.operations.ImagesSet`.

GAP 3.4.4
April 1997