Outline

There are three main points of interest in the titration graphic, and two you have found yourself. The three points are


The start at $V_\text{titr}=0$
Halfway to the equivalence point at $V_\text{titr}=10~\mathrm{mL}$
The equivalence point at $V_\text{titr} = 20~\mathrm{mL}$


Why is number 2 important? Because that is where we can read out the $\text{p}K_\text{a}$ value of the acid, because at that point $[\ce{HA}] = [\ce{A-}]$.

Now, armed with this information, here is how to proceed:


Find out total amount of acid
Find out total concentration of acid
Calculate the initial volume from the data gathered in steps 1 and 2


1  Total amount of acid

The total amount of acid can be gleaned from information point 3, the equivalence point.

$$ n_\text{eq} = V_\text{titr,eq} \cdot c_\text{titr} = 20~\mathrm{mL} \cdot 0.150~\mathrm{mol\,L^{-1}} = 0.003~\mathrm{mol} $$

2  Total concentration of acid

The total concentration can be calculated from information points 1 and 2. We know the initial concentrations (denoted by subscript $_0$) because of the pH value at the beginning:
$$ [\ce{A-}]_0 = [\ce{H+}]_0 = 10^{-3}$$

Using the equilibrium constant that we got at point two, we can calculate the initial concentration of the associated (un-dissociated) acid species:
$$ [\ce{HA}]_0 = \frac{[\ce{H+}][\ce{A-}]}{K_\text{a}} = \frac{10^{-6}}{10^{-5}} = 10^{-1} $$

The total initial concentration of all acid is then trivial:
$$ [\ce{A}]_\text{tot,0} = [\ce{HA}]_0 + [\ce{A-}]_0 = 0.101 $$

Note that we here actually calculated the activities and not concentrations. Since we assume an activity coefficient of $\gamma = 1$ because we only consider dissolved species, the concentrations are simply the activity multiplied with the standard concentration:
$$ c(\ce{A})_\text{tot,0} = \gamma \cdot [\ce{A}]_\text{tot,0} \cdot 1~\mathrm{mol\,L^{-1}} = 0.101~\mathrm{mol\,L^{-1}} $$

3  Calculation of the initial volume

The initial volume is now calculated following the simple concentration formula:
$$ c_0 = \frac{n_0}{V_0} \Leftrightarrow V_0 = \frac{n_0}{c_0}$$

Since the amount of acid is constant ($n = n_0\; \mathrm{const}$), we can easily fill in the values:
$$ V_0 = \frac{0.003~\mathrm{mol}}{0.101~\mathrm{mol\, L^{-1}}} \approx 0.0297~\mathrm{L} = 29.7~\mathrm{mL} $$

Find the initial volume of the weak acid given a titration graph
I'm trying to write this script for an assignment - it's only the second one I've written so bear with me. 

As a part of this script, I need to be able to check if the first argument given matches the first word of file. If it does, exit with an error message, if it doesn't, append the arguments to the file. I understand how to write the if statement, but not how to use grep within a script. I understand that grep will look something like this

grep ^$1 schemas.txt

I feel like this should be much easier than I am making it. Any help appreciated. 

Update:
I'm getting an error too many arguments on the if statement. I got rid of the space between grep-q and then got an error binary operator expected. I've been poking around at it, but I don't see what it sees.

if [ grep -q ^$1 schemas.txt ]
then
        echo "Schema already exists. Please try again"
        exit 1
else
        echo "$@" &gt;&gt; schemas.txt
fi

