0

I am new to latex and I am having trouble typing the function range before I define the function. So I am trying to define a piecewise function, and how would I have something like this?enter image description here

catie
  • 1
  • 1
  • 1
    Welcome! Please always provide an MWE for your question. Assuming that you load the amssymb package, the code is $f:\mathbb{N}\mapsto\mathbb{N}$, but you should really use \to instead of \mapsto here. –  Jan 26 '18 at 04:59
  • Hi, for some reason, it keeps giving me undefined control sequence when I use mathbb. – catie Jan 26 '18 at 05:02
  • 2
    add \usepackage{amssymb} to your preamble – koleygr Jan 26 '18 at 05:04
  • I posted a code below. Please tell me when you read and understood it, I'll erase it then. –  Jan 26 '18 at 05:18

1 Answers1

2

Thanks, Mico!

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
$f\colon\mathbb{Z}\to\mathbb{N}$ is more correct than
$f\colon\mathbb{Z}\mapsto\mathbb{N}$.
\begin{align}
 f\colon\mathbb{Z}&\to\mathbb{N}\notag\\
 n&\mapsto \left( n\mod 3\right)^2
\end{align}
\end{document}

enter image description here