# Tikz graph error

I'm trying to plot the curve of

\frac{1}{x - 1}


My code is as follows:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{color}
\usepackage[left=1.5in,right=1.5in,top=0.5in,bottom=0.5in,
footskip=0in]{geometry}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\draw [red] (0,0) plot [domain=0.5:4] (\x,1/(\x-1));
\end{tikzpicture}

\end{document}


This throws an error.

If I write this:

\begin{tikzpicture}
\draw [red] (0,0) plot [domain=0.5:4] (\x,1/x);
\end{tikzpicture}


It's fine. It can handle this.

The error message is:

Package tikz Error: Giving up on this path. Did you forget a semicolon?. ... plot [domain=0.5:4] (\x,1/(\x-1))

Any idea what's going on?

The issue is the double brackets. You should put the expression within {}. And then have the (x-1) within the brackets so the eventual \begin{tikzpicture} input should look like:
\begin{tikzpicture}